-1
\$\begingroup\$

History

There's a room on StackOverflow in Russian where you can see such an interesting discussion:

enter image description here

Just because there are not enough real discussing in that room, @Grundy "plays ping-pong" to keep it unfrozen.

Task

Implement a bot for StackExchange that posts "ping!" to the 115624 room if the previous message was "pong!" **(and posted by another user) and "pong!" if the previous message was "ping!" (and posted by another user). If you need a login and a password for SE account, use l and p.

**It should not reply to its own messages

Rules

Code-golf: the shortest answer wins.

Nice golfing!

\$\endgroup\$
  • 2
    \$\begingroup\$ The idea is kinda fun but could it be considered a borderline malicious code? Using sockpuppet accounts may also be a problem. (But I don't really know for sure.) \$\endgroup\$ – Arnauld Oct 28 at 18:38
  • 1
    \$\begingroup\$ @Arnauld No. Firstly you can use your own account. And... using an additional account for your bot is not considered a violation if you don't break these rules. \$\endgroup\$ – Victor VosMottor Oct 28 at 18:51
  • 6
    \$\begingroup\$ @Arnauld Sockpuppet accounts are allowed for chat bots (assuming they don't break any normal rules), but I would recommend creating your own chatroom for this, rather than spamming into a different chatroom (even if that's what the room is for) \$\endgroup\$ – caird coinheringaahing Oct 28 at 18:57
  • 7
    \$\begingroup\$ Furthermore, I would highly recommend that you start using the Sandbox for your challenge ideas \$\endgroup\$ – caird coinheringaahing Oct 28 at 18:59
  • 5
    \$\begingroup\$ I'd recommend posting the messages to room 1 (sandbox). You can put bots and do basically whatever you want there because it's just the place for anyone to test anything (that isn't spam/R/A of course) \$\endgroup\$ – HyperNeutrino Oct 28 at 19:41
1
\$\begingroup\$

Nobody golfs... so:

Python 3 — 330 byte

from chatexchange.client import Client
s=Client("stackexchange.com");s.login('l','p');r=s.get_room('115624');r.join();o=lambda e,_:r.send_message("ping!")if e.message.content_source=='pong!'and e.user.id!=483667 else r.send_message('pong!')if e.message.content_source=='ping!'and e.user.id!=483667 else 0;r.watch_socket(o)
while 1:0
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.