Make EchoBot support group chats

This commit is contained in:
2021-01-13 14:31:00 +01:00
parent e0c8583b2d
commit 1137624180
2 changed files with 14 additions and 14 deletions

View File

@ -192,7 +192,11 @@ class EchoBot(Bot):
def react(self, message):
"""Send back what we get."""
if message.type == "chat":
self.reply(message.body, to=message.sender)
self.reply(message.body, to=message.source)
if message.type == "groupchat" and "echobot" in message.body:
_, to_echo = message.body.split(":")
self.reply(to_echo, room=message.source)
class WhisperBot(Bot):