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()