bots/echobot/echobot.py

27 lines
640 B
Python
Raw Normal View History

2021-02-03 09:55:26 +01:00
from xbotlib import Bot
class EchoBot(Bot):
"""Responds with whatever you send.
Simply direct message the bot and see if you get back what you sent. It
also works in group chats but in this case you need to summon the bot using
its nickname.
"""
help = "I echo messages back 🖖️"
def direct(self, message):
"""Send back whatever we receive."""
self.reply(message.text, to=message.sender)
def group(self, message):
"""Send back whatever receive in group chats."""
if message.url:
return
self.reply(message.content, room=message.room)
EchoBot()