Yet another Matrix bot library.
Project description
mxbt
Yet another Matrix bot library.
Installation
$ pip install mxbt
Usage
credits.json:
{
"homeserver" : "https://matrix.org",
"user_id" : "user",
"password" : "password"
}
from mxbt import Bot, Context
bot = Bot(
prefix="!", # Standart command prefix, commands can setup it own prefix
creds="credits.json" # Creds may be filename or dict with credits data
)
@bot.listener.on_command(prefix="?", alliases=["test", "t"])
@bot.filter.from_users(['@username:homeserver']) # Event works only with this senders
async def ctx_echo(ctx: Context) -> None: # Context object contains main info about event
await ctx.send_text(ctx.body, reply=True) # Reply message to event room
@bot.listener.on_message
async def echo(room, message) -> None:
await bot.api.send_text(
room.room_id, message.body,
reply_to=message.event_id
)
bot.run()
Special thanks
- simplematrixbotlib for base parts of API, Listener and Callbacks code ideas.
- matrix-nio for cool client library.
Contacts
Contact | Description |
---|---|
Matrix |
Matrix server |
Donates
Monero/XMR: 47KkgEb3agJJjSpeW1LpVi1M8fsCfREhnBCb1yib5KQgCxwb6j47XBQAamueByrLUceRinJqveZ82UCbrGqrsY9oNuZ97xN
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mxbt-0.0.5.tar.gz
(20.3 kB
view hashes)
Built Distribution
mxbt-0.0.5-py3-none-any.whl
(21.2 kB
view hashes)