Skip to main content

An easy to use bot library for the Matrix ecosystem written in Python.

Project description

Simple-Matrix-Bot-Lib

(Version 2.12.0)

Simple-Matrix-Bot-Lib is a Python bot library for the Matrix ecosystem built on matrix-nio.

View on Codeberg 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 Codeberg.

Installation from PyPi:

python -m pip install simplematrixbotlib

Read the docs to learn how to install E2E encryption support.

Download from Codeberg:

git clone --branch master https://codeberg.org/imbev/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


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.12.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

simplematrixbotlib-2.12.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file simplematrixbotlib-2.12.0.tar.gz.

File metadata

  • Download URL: simplematrixbotlib-2.12.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.9.9-200.fc40.x86_64

File hashes

Hashes for simplematrixbotlib-2.12.0.tar.gz
Algorithm Hash digest
SHA256 b8d357a9d32ef85284235504c64b885943fa1fb850a3ab7cb289455fc2ee7eb0
MD5 6149db9a7e32019ba45a59dfadbe6512
BLAKE2b-256 b47937c23ad688565e3e0d9cee4b1d36b59be91e0726b2a1490e5cd1981bcca6

See more details on using hashes here.

File details

Details for the file simplematrixbotlib-2.12.0-py3-none-any.whl.

File metadata

  • Download URL: simplematrixbotlib-2.12.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.9.9-200.fc40.x86_64

File hashes

Hashes for simplematrixbotlib-2.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 979b5149d6eb937aebb1cef0f6f67f95991b8c4996db52936e594eb2ca05b029
MD5 7bccc2db8e502523e789b8634b5312e0
BLAKE2b-256 c52152aac30fea69e83dc1dbf1900e2ccd7cfe72e7c44cf5e5fcfceba6830d80

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page