utilitarian-first general-purpose d*scord bot that doesn't stand in your way
prerequisites:
- python 3.11+
- poetry
clone the repository before anything else, and enter it:
git clone https://github.com/markjoshwel/reixi
cd reixi
then install dependencies and run reixi:
poetry install
REIXI_TOKEN="" poetry run reixi
devbox user? do the following instead:
git clone https://github.com/markjoshwel/reixi
cd reixi
REIXI_TOKEN="" devbox run reixi
to see what other environment variables you can set, see environment variables.
- when generating an invite link, ensure the
bot
scope is selected, and that theAdministrator
permission is selected. - ensure reixi's role is above the roles you want it to manage.
- the default prefix is
rx
, but this can be changed per-server withrx pre
, or globally by editingreixi/common.py
. - all modules are disabled per-server by default. enable them with
rx module
-
REIXI_TOKEN
the discord bot token, required -
REIXI_LOG_DIR
where to store logs inif not specified, the following directories are tried in order:
XDG_RUNTIME_DIR/reixi
PWD/logs
-
REIXI_DB_PATH
where to store database files and the config fileif not specified, the following directories are tried in order:
XDG_DATA_HOME/reixi
~/.local/share/reixi
PWD/db
the configuration file is a TOML file located at $REIXI_DB_PATH/.config.toml
.
# user ids of who can use reixi god commands
# usually justthe bot owner
gods = []
# list of modules to load
# append to this list to third-party modules
# the strings should follow python module import syntax
modules = [
"reixi.builtins.serverprefixes",
"reixi.builtins.reactionroles",
]
reixi is fully type-annotated, so use mypy to check for type errors.
reixi modules are discord.ext.commands.Cog
.
from discord.ext import commands
# this should be a lowercase version of the module class name
NAME = "testmodule"
class TestModule(commands.Cog):
# these two lists aren't required
# unless you want to hide them from the help command
reixi_god_commands: list[str] = [] # commands that only bot owners/gods can use
reixi_privileged_commands: list[str] = [] # commands that only server owners/admins can use
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@commands.command()
async def test(self, ctx: commands.Context) -> None:
# check if module is server-disabled
if not await self.bot.db.get_module_enabled(ctx.guild.id, NAME):
return
await ctx.send("test!")
async def setup(bot: Bot) -> None:
await bot.add_cog(ReactionRoles(bot))
you can access the database backend via bot.db
.
-
config is stored in
bot.db.config
and is of typereixi.common.Config
. -
server settings are stored in
bot.db.server_settings
and is of typedict[int, reixi.common.ServerSettings]
.access a guild's settings by using its id as a key when indexing the dictionary.
-
see available db methods by looking at
reixi.db.AbstractBackend
.
place the module somewhere reixi/reixi.py
can find them, or install them as a package.
then, add them into the modules list in your reixi config.
reixi saves data as TOML files, but under an abstraction layer.
write your own database backend by implementing and extending the abstract base class
reixi.db.AbstractBackend
, and then swap it out with the TOML backend by modifying
reixi/reixi.py
. (ctrl+f and NOTE
should help you find the line!)
reixi is licenced under the GNU Affero General Public Licence v3.0 or later.
for more information, please refer to LICENCE.md, or the GNU website.
if you run reixi or a modified version of it, you must provide the source code to the users of the bot, this is a requirement of the GNU AGPL.