2
1
Fork
You've already forked mxbt
0
Yet another Matrix bot library. https://librehub.codeberg.page/mxbt/
  • Python 100%
Find a file
2025年10月29日 23:49:56 +03:00
docs Update README 2024年07月14日 12:26:01 +03:00
examples Implement full Location sending support 2024年06月16日 09:35:18 +03:00
mxbt Use header auth for Auth Token check per MSC4126 ( #8 ) 2025年10月29日 23:49:56 +03:00
res Update README 2024年07月14日 12:26:01 +03:00
.gitignore Initial commit 2023年09月24日 15:13:41 +03:00
LICENSE move to MIT license 2025年05月21日 14:49:43 +03:00
README.md Another README update 2024年07月14日 12:36:35 +03:00
setup.py Replace python-cryptography-fernet-wrapper with cryptography module 2024年05月06日 14:17:43 +03:00

Yet another Matrix bot library, built on matrix-nio.

Feauters

  • Custom emojis support
  • Files sending (external & internal)
  • Native mentions
  • Access to matrix-nio features
  • Event filters
  • Module system support
  • 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"])
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

Special thanks

  • matrix.org for beautiful protocol.
  • 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-2024 Isaac Beverly
  • matrix-nio for cool client library.
  • build-with-mxbt - list of all apps maden with mxbt.

Support

Any contacts and crytpocurrency wallets you can find on my profile page.