Skip to main content

A Python wrapper for the Matrix API

Project description

Matrix.py

Matrix.py is a matrix bot library, inspired by the discord.py library by Rapptz. It is still in early beta, so don't expect it to be running smoothly yet.

It aims to be a modern, easy to use, feature-rich and async ready API wrapper for the Matrix system written in Python.

The documentation can be found here, examples can be found in the examples folder.

Installing

The package can be installed from pypi, via

$ pip install matrix-chat

You need to have gcc and the libolm package installed.

Quick Example

import matrix 

class MyClient(matrix.Client):
    def on_ready(self):
        print('Logged on as', self.user)

    def on_message(self, message: matrix.Message):
        # don't respond to ourselves
        if message.author == self.user:
            return

        print(f"[Room: {message.room.id}] {message.author}: {message.content}")

    def on_invite(self, invite: matrix.Invite):
        print(f"{invite.inviter} has invited you to join {invite.room_id}")

client = MyClient()
client.run(
    username='@bot:matrix.org',
    password='password',
    homeserver='https://matrix.org',
)

Limitations

  • It is still in an early version - not tested enough
  • Matrix.py doesn't yet support e2ee - it wont join or respond in encrypted rooms.

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

matrix-chat-0.0.1.2.tar.gz (14.2 kB view details)

Uploaded Source

File details

Details for the file matrix-chat-0.0.1.2.tar.gz.

File metadata

  • Download URL: matrix-chat-0.0.1.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8rc1

File hashes

Hashes for matrix-chat-0.0.1.2.tar.gz
Algorithm Hash digest
SHA256 de97a9fd346e06a9d9943499eddc122b62ac22214bff0dea4a8b224c61f0a44b
MD5 639fe8df2bbe993a5790f489385ca282
BLAKE2b-256 81f4ce2fe4c1bf1637eae5bbece76dcbd8600f81cd6fdcf670d38466abc417c9

See more details on using hashes here.

Supported by

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