Yet another Matrix bot library.
Project description
mxbt
Yet another Matrix bot library.
Installation
$ pip install mxbt
Getting started
More examples here.
credits.json:
{
"homeserver" : "https://matrix.org",
"user_id" : "user",
"password" : "password"
}
from mxbt import Bot, Context, Creds
bot = Bot(
prefix="!", # Standart command prefix, commands can setup it own prefix
creds=Creds.from_json_file("credits.json")
)
@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.1.1.tar.gz
(23.8 kB
view hashes)
Built Distribution
mxbt-0.1.1-py3-none-any.whl
(25.6 kB
view hashes)