Metadata-Version: 2.1
Name: mxbt
Version: 0.0.7
Summary: Yet another Matrix bot library.
Home-page: https://codeberg.org/librehub/mxbt
Author: loliconshik3
Author-email: loliconshik3@gmail.com
Keywords: python,matrix-nio,matrix,bot,api
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matrix-nio

# mxbt 

Yet another Matrix bot library.

## Installation

```sh
$ pip install mxbt
```

## Usage

**credits.json:**
```json
{
    "homeserver" : "https://matrix.org",
    "user_id" : "user",
    "password" : "password"
}
```

```python
from mxbt import Bot, Context

bot = Bot(
    prefix="!",          # Standart command prefix, commands can setup it own prefix
    creds="credits.json" # Creds may be filename or dict with credits data
)

@bot.listener.on_command(prefix="?", alliases=["test", "t"])
@bot.filter.from_users(['@username:homeserver']) # Event works only with this senders
async def ctx_echo(ctx: Context) -> None: # Context object contains main info about event
    await ctx.send_text(ctx.body, reply=True) # Reply message to event room

@bot.listener.on_message
async def echo(room, message) -> None:
    await bot.api.send_text(
        room.room_id, message.body,
        reply_to=message.event_id
    )

bot.run()
```

## Special thanks

* [simplematrixbotlib](https://codeberg.org/imbev/simplematrixbotlib) for base parts of API, Listener and Callbacks code ideas.
* [matrix-nio](https://github.com/poljar/matrix-nio) for cool client library.

## Contacts

| Contact                                               | Description       |
| :---:                                                 | :---              |
| [`Matrix`](https://matrix.to/#/#librehub:matrix.org)  | Matrix server     |

## Donates
**Monero/XMR:** `47KkgEb3agJJjSpeW1LpVi1M8fsCfREhnBCb1yib5KQgCxwb6j47XBQAamueByrLUceRinJqveZ82UCbrGqrsY9oNuZ97xN`

