An easy to use bot library for the Matrix ecosystem written in Python. https://matrix.to/#/#simplematrixbotlib:matrix.org
 
 
Go to file
Isaac Beverly d8faadb3cd Merge pull request 'Fix Incorrect formatting of text in markdown' (#49) from fix/issue-48/markdown-formatting into master
Reviewed-on: #49
2023-09-18 02:48:16 +00:00
.github
doc Issue #48 * Bump project version to 2.10.1 2023-09-17 21:40:53 -05:00
examples
simplematrixbotlib
tests
.gitignore
CHANGELOG.md Issue #48 * Update CHANGELOG.md 2023-09-17 21:47:09 -05:00
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
README.md Issue #48 * Bump project version to 2.10.1 2023-09-17 21:40:53 -05:00
SECURITY.md
poetry.lock Issue #48 * Bump project version to 2.10.1 2023-09-17 21:40:53 -05:00
pyproject.toml Issue #48 * Bump project version to 2.10.1 2023-09-17 21:40:53 -05:00
setup.py

README.md

Simple-Matrix-Bot-Lib

(Version 2.10.1)

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

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.