A bot to manage user registration tokens on a matrix server.
Project description
Matrix Registration Bot
This bot aims to create and manage registration tokens for a matrix server. It wants to help invitation based servers to maintain usability. It does not create a user itself, but rather aims to make use of MSC3231. The feature is still experimental. More information can be found in the Synapse Documentation.
Getting started
Prerequisites
Server configuration
Your server should be configured to a token restricted registration. Add the following to your homeserver.yaml
:
enable_registration: true
registration_requires_token: true
Create a bot account
Then you need to create an account for the bot on the server, like you would do with any other account.
A good username is registration-bot
. Also note the access token of the bot. One way to get the token is to login as
the bot and got to Settings -> Help & About -> Access Token in Element.
Once you are finished you can start the installation of the bot.
Installation
The installation can easily be done via PyPi
$ pip install matrix-registration-bot
Configuration
Configure the bot with a file named config.yml
. It should look like this
bot:
server: "https://synapse.example.com"
username: "registerbot"
access_token: "verysecret"
api:
# API endpoint of the registration tokens
base_url: 'https://synapse.example.com'
endpoint: '/_synapse/admin/v1/registration_tokens'
# Access token of an administrator on the server
token: "supersecret"
Usage
Start the bot with
python -m matrix_registration_bot.bot
and then open a Direct Message to the bot. The type one of the following commands.
Supported commands
Unrestricted commands
help
: Shows this help
Restricted commands
list
: Lists all registration tokensshow <token>
: Shows token details in human-readable formatcreate
: Creates a token that that is valid for one registration for seven daysdelete <token>
Deletes the specified token(s)delete-all
Deletes all tokensallow @user:example.com
Allows the specified user (or a user matching a regex pattern) to use restricted commandsdisallow @user:example.com
Stops a specified user (or a user matching a regex pattern) from using restricted commands
Permissions
By default, any user on the homeserver of the bot is allowed to use restricted commands. You can change that,
by using the allow
command to configure one (or multiple) specific user. Read the simple-matrix-bot documentation
for more information. If you get locked out for any reason, simply modify the config.toml that is created in the bots
working directory.
Contributing
Feel free to contribute or discuss this bot with me. You can reach me via @moanos:hyteck.de. The project is made possible by Simple-Matrix-Bot-Lib.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for matrix_registration_bot-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4ddbac68c1eceb17d31c6caf23562c341904ea5668b1e120a7a3dde5ba4380b |
|
MD5 | 3ff101994b33b2881baf6f595e146d65 |
|
BLAKE2b-256 | 77aee570a51b15ac5a882c8bbea311ba1784b5d473381913853919d136b66baf |