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.3.tar.gz
(24.0 kB
view details)
Built Distribution
mxbt-0.1.3-py3-none-any.whl
(25.7 kB
view details)
File details
Details for the file mxbt-0.1.3.tar.gz
.
File metadata
- Download URL: mxbt-0.1.3.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de3f9e89c394c660322ea820a6e3667f6b3a63855286d5505593b2022c7855e1 |
|
MD5 | 0da08d3137112e7c4e173b0f222db39e |
|
BLAKE2b-256 | 36c1315f1eeca89021056f8d377ea439934ca18d88aa3f78f1cb32b743c954d3 |
File details
Details for the file mxbt-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: mxbt-0.1.3-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25c9ef6fac82d91c7f9123669045b1b887f359327270ae010d3c702ce9135284 |
|
MD5 | 77c2d2973532b3c21f2465e6973f47e9 |
|
BLAKE2b-256 | 7031fb584bb42291a1890d178db163c0c6a11a7e3256e58e816f3cd82f2fa992 |