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 details)
Built Distribution
mxbt-0.0.5-py3-none-any.whl
(21.2 kB
view details)
File details
Details for the file mxbt-0.0.5.tar.gz
.
File metadata
- Download URL: mxbt-0.0.5.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 989e9f02c2f86105221a40a0f7dc716eb37ad15db2e36f01c42fcd21b637e376 |
|
MD5 | 26ea312ef64aca8f4fd380b10906b118 |
|
BLAKE2b-256 | a35a5ab4fd62845c67f709a22a351826c1e92e2f638a6cb8e721b5b9410b4afd |
File details
Details for the file mxbt-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: mxbt-0.0.5-py3-none-any.whl
- Upload date:
- Size: 21.2 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 | 6915e07e5a17e60cfe370fbb228ba5adc1fbc3bea838cba40171c035f530ed45 |
|
MD5 | 6d1f7b92b1e37e897bdfbdd2e39a1e81 |
|
BLAKE2b-256 | bb3f50d1a3fcd2ab1573db26b4153b54ec12fa92532b12812ef57bcf191e3cf6 |