forked from varia/bots
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
640 B
26 lines
640 B
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()
|
|
|