Yet another Matrix bot library.
Project description
mxbt
Yet another Matrix bot library, built on matrix-nio.
Feauters
- Simple and powerfull bots creating
- Custom emojis support
- Getting
- Sending
- Creating
- Files sending
- External files
- Internal files
- Native mentions
- Access to
matrix-nio
features - Event filters
- Bot modules support
- Wait for event system
- E2EE support (check docs before)
Installation
With pip:
$ pip install mxbt
With git and python:
$ git clone https://codeberg.org/librehub/mxbt
$ cd mxbt
$ python -m pip install .
Getting started
More examples here or in docs.
from mxbt import Bot, Context, Creds, Config, Filter, Listener
import asyncio
bot = Bot(
creds=Creds.from_env( # You also can use Creds.from_json and just Creds()
homeserver="MATRIX_HOMESERVER",
username="MATRIX_USERNAME",
password="MATRIX_PASSWORD"
),
config=Config() # Config has many options for bot, like prefix, selfbot, encryption, etc...
)
lr = Listener(bot)
@lr.on_command(prefix="?", aliases=["test", "t"])
@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.reply(ctx.body) # Reply message to event room
if __name__ == "__main__":
asyncio.run(lr.start_polling())
.env structure
MATRIX_HOMESERVER=https://matrix.org/
MATRIX_USERNAME=user
MATRIX_PASSWORD=password
Built with mxbt
Project | Description |
---|---|
sofie | A simple selfbot |
cryptomx | A crytpocurrency notification bot |
Special thanks
- simplematrixbotlib for base parts of API, Listener and Callbacks code ideas. Code from simplematrixbotlib is included under the terms of the MIT license - Copyright (c) 2021-2023 Isaac Beverly
- matrix-nio for cool client library.
Support
Any contacts and crytpocurrency wallets you can find on my profile page.
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.3.6.tar.gz
(32.5 kB
view details)
Built Distribution
mxbt-0.3.6-py3-none-any.whl
(34.9 kB
view details)
File details
Details for the file mxbt-0.3.6.tar.gz
.
File metadata
- Download URL: mxbt-0.3.6.tar.gz
- Upload date:
- Size: 32.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 003c2740f1bacbeb0e009016fa29b4628fa3507b39897d28624b67ade547eb0a |
|
MD5 | a96b18aa5f631d6f245c6d1c3e591a63 |
|
BLAKE2b-256 | 0cef323236e207642e1285fa2960a85cbec8f8cdff1ebbd7ebe97f95a4c15344 |
File details
Details for the file mxbt-0.3.6-py3-none-any.whl
.
File metadata
- Download URL: mxbt-0.3.6-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 491e107f9f711829f85822738eb31c24a60803b7445941535f3dbe8be8192ff5 |
|
MD5 | 9f5072c421a1560b6e5b4b89f99f9409 |
|
BLAKE2b-256 | c3050c445fba0cce7ebcb2dbaae3064ed8937251d62c5b4f7f2420469bd14b61 |