Simple-Matrix-Bot-Lib
(Version 1.2.x)
simplematrixbotlib is a Python 3 library for quickly building Matrix bots. It uses matrix-nio as its Matrix client library. View on Github or View on PyPi
Installation
To use it, simplematrixbotlib can be either installed from pip or downloaded from github.
Installation from pip:
python -m pip install simplematrixbotlib
Download from github:
git clone --branch master https://github.com/KrazyKirby99999/simple-matrix-bot-lib.git
Example Usage
import simplematrixbotlib as botlib
creds = botlib.Creds("home.server", "user", "pass")
bot = botlib.Bot(creds)
bot.run()
Features
Complete:
-
Login to homeserver - bot automatically login upon the execution of bot.run()
import simplematrixbotlib as botlib creds = botlib.Creds("home.server", "user", "pass") bot = botlib.Bot(creds) bot.run() #Logs in during the execution of this line
-
Join room on invite - bot automatically join rooms that the bot is invited to upon execution of bot.run(), or upon invite if the bot is running
-
Send message - bot can send messages in response to other messages, and can also run other code in response to messages as well as filter the messages that the bot responds to
import simplematrixbotlib as botlib creds = botlib.Creds("home.server", "user", "pass") bot = botlib.Bot(creds) async def say_something_to_a_message_not_from_bot(room, message): #Must be an "async" function with (room, message) arguments if not message.sender == bot.async_client.user_id: #Optional, prevents the bot from reacting to its own messages await bot.api.send_text_message(room.room_id, "something") #Send a message containing "something" to room bot.add_message_listener(say_something_to_a_message_not_from_bot) #Listen for messages, can have as many message listeners as needed, each added using bot.add_message_listener bot.run()
In Progress:
Planned:
Dependencies
Python:
External:
Metadata
Release files for simplematrixbotlib 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simplematrixbotlib-1.2.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simplematrixbotlib-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / simplematrixbotlib-1.2.0.tar.gz
| Download URL | simplematrixbotlib-1.2.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5acebbe6a2ea85aa9172917d2953778358a9c511e7b05148e339de10974aa6f
|
|
BLAKE2b-256 checksum How to use checksums |
3cfda8786233203738990679b514814a67cab0b5d12dae1bee9a3832d5871217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|
Release files / simplematrixbotlib-1.2.0-py3-none-any.whl
| Download URL | simplematrixbotlib-1.2.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e675abefa638bacd13aae3295dc0e4b54f1110b7bbdf0b4350e12c098a050231
|
|
BLAKE2b-256 checksum How to use checksums |
23f521333e9be7ec040975312bc3c8591185dfb24b39cd1ac45ab80e85ec66f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
|