This repository has been archived on 2024-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
2021-01-10 16:51:20 +01:00
2021-01-10 16:51:20 +01:00
2021-01-10 15:05:44 +01:00
2021-01-10 14:10:39 +01:00
2021-01-10 14:10:39 +01:00
2021-01-10 14:10:39 +01:00
2021-01-10 14:10:39 +01:00
2021-01-10 16:51:20 +01:00
2021-01-10 16:51:20 +01:00

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.

Description
XMPP bots for humans
Readme 312 KiB
Languages
Python 100%