diff --git a/README.md b/README.md index 597c0e6..6b5de32 100644 --- a/README.md +++ b/README.md @@ -48,11 +48,9 @@ class EchoBot(Bot): """ def react(self, message): if message.type == "chat": - # Reply to direct messages - self.reply(message.body, to=message.source) + self.reply(message.body, to=message.sender) if message.type == "groupchat" and "echobot" in message.body: - # Parse and reply group chat messages _, to_echo = message.body.split(":") self.reply(to_echo, room=message.room) ``` @@ -101,7 +99,8 @@ accepts a `message` argument. Attributes: - **body**: the body of the message -- **source**: where the message came from (can be a user or a room) +- **sender**: the user the message came from +- **room**: the room the message came from - **receiver**: the receiver of the message - **nickname**: the nickname of the sender - **type**: the type of message (`chat` or `groupchat`) diff --git a/xbotlib.py b/xbotlib.py index d9fa76b..e357d26 100644 --- a/xbotlib.py +++ b/xbotlib.py @@ -21,7 +21,7 @@ class SimpleMessage: return self.message["body"] @property - def source(self): + def sender(self): return self.message["from"] @property @@ -196,7 +196,7 @@ class EchoBot(Bot): def react(self, message): """Send back what we get.""" if message.type == "chat": - self.reply(message.body, to=message.source) + self.reply(message.body, to=message.sender) if message.type == "groupchat" and "echobot" in message.body: _, to_echo = message.body.split(":")