xbotlib
XMPP bots for humans
Install
$ pip install xbotlib
Example
from xbotlib import Bot
class EchoBot(Bot):
def reply_direct_chat(self, message):
self.send_direct_chat(to=message.sender, body=message.body)
MyBot()
And then python echo.py
.
More Examples
- EchoBot: Sends back what you sent it
- WhisperBot: Pseudo-anonymous whispering in group chats
See the examples directoy for all listings.
API Reference
Your bot always sub-classes the Bot
class provided from xbotlib
. All
underling functions can be extended. For example, if you want to enable more
plugins or add different functionality. If something feels awkward then please
raise a ticket for that. See the one file source here.
send_direct_chat
Send back a response to a direct chat message.
Arguments:
- to: who to send it to (can be a user or a room)
- body: the message to send
send_group_chat
Send back a response to a group chat message.
Arguments:
- to: who to send it to (can be a user or a room)
- body: the message to send
Roadmap
-
The library only handles reactions. The bots can only send messages when they receive a message. It would be nice to allow for sending messages at specific times.
-
Extend the
bot.conf
to allow for multiple bot configurations. -
Sort out something for how to deploy them. It's easy to run them locally but hard to run them on server. Maybe something can be done for that as well.
Changes
See the CHANGELOG.md.
License
See the LICENSE.