https://github.com/rizerphe/matrix-client
A very basic matrix API wrapper
https://github.com/rizerphe/matrix-client
Last synced: 9 days ago
JSON representation
A very basic matrix API wrapper
- Host: GitHub
- URL: https://github.com/rizerphe/matrix-client
- Owner: rizerphe
- Created: 2024-03-30T21:55:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T08:58:24.000Z (about 2 years ago)
- Last Synced: 2025-03-05T12:34:08.625Z (over 1 year ago)
- Language: Python
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Matrix-client
A simple matrix API wrapper for python. I don't know why I didn't just use/wrap matrix-nio or something, but oh well, now I made this. I mean, I guess it supports message edits way better than nio and anything nio based? Cause they're a separate event type here, and with nio you gotta do a bit of magic fuckery to distinguish between messages and message edits? So that's kinda cool?
## Installing
Because `matrix-client` is already taken on pypi, because I lack creativity and because I don't think this project is large enough to publish there as of yet, you can only install it directly from github:
```python
pip install git+https://github.com/rizerphe/matrix-client.git
```
## Usage
```python
import os
from dotenv import load_dotenv
from matrix_client import Client, MessageEvent
client = Client("https://matrix.org")
@client.on.message
async def on_message(message: MessageEvent) -> None:
print(message)
if __name__ == "__main__":
load_dotenv()
client.run(
os.getenv("MATRIX_USERNAME", ""),
os.getenv("MATRIX_PASSWORD", ""),
)
```