An easy to use bot library for the Matrix ecosystem written in Python.
Project description
Simple-Matrix-Bot-Lib
(Version 2.11.0)
Simple-Matrix-Bot-Lib is a Python bot library for the Matrix ecosystem built on matrix-nio.
View on Github or View on PyPi or View docs on readthedocs.io
Learn how you can contribute here.
Features
- hands-off approach: get started with just 10 lines of code (see example)
- end-to-end encryption support
- limited verification support (device only)
- easily extensible config file
- user access management
- access the matrix-nio library to use advanced features
Installation
simplematrixbotlib can be either installed from PyPi or downloaded from github.
Installation from PyPi:
python -m pip install simplematrixbotlib
Read the docs to learn how to install E2E encryption support.
Download from github:
git clone --branch master https://github.com/i10b/simplematrixbotlib.git
Example Usage
# echo.py
# Example:
# randomuser - "!echo example string"
# echo_bot - "example string"
import simplematrixbotlib as botlib
creds = botlib.Creds("https://home.server", "echo_bot", "pass")
bot = botlib.Bot(creds)
PREFIX = '!'
@bot.listener.on_message_event
async def echo(room, message):
match = botlib.MessageMatch(room, message, bot, PREFIX)
if match.is_not_from_this_bot() and match.prefix() and match.command("echo"):
await bot.api.send_text_message(
room.room_id, " ".join(arg for arg in match.args())
)
bot.run()
More information and examples can be found here.
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
simplematrixbotlib-2.11.0.tar.gz
(14.3 kB
view hashes)
Built Distribution
Close
Hashes for simplematrixbotlib-2.11.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f620d95889ea5db6f8e6d31f672b00187969e65290cd0c2777b4fc69e023001c |
|
MD5 | f29d53cb3da9b6b22999270ea4e5b055 |
|
BLAKE2b-256 | 2e9c745909112f035a4371477fd8eb75808f368b479464d1b928ad5fe3ad2416 |
Close
Hashes for simplematrixbotlib-2.11.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a12dfa91ff11372c568806b2e8ec540bc7f9112e379cf7270a9043877ea5322d |
|
MD5 | 425aec29f1ec2ab27c9d2f125f52ae22 |
|
BLAKE2b-256 | 693b7ea564940b9b7fd0996fdb793d57bec4cd72aac80170b5cc67aa9e44cd98 |