Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An easy to use serenity reaction role bot, easy to configure!

License

NotificationsYou must be signed in to change notification settings

Arthurdw/Reaction-Role

Repository files navigation

Made withMIT LicenseLanguageDocker Image VersionDocker Pulls

About

🔥 The bot has been fully rewritten in Rust! 🔥(check outMigrating)

This is a easy to use Discord bot with human friendly configuration files.

Features

  • Emoij Reaction Roles (also works with custom emoji's)
  • Experience/Leveling system with leaderboard
  • Token configurable from env (also loads .env) or config file
  • Reaction logging
  • Chat and slash command support (configurable)
  • Configurable rich presence
  • Configurable verbose logging

Getting started

Discord setup

Creating a bot and finding your token

Go to theDiscord Developer Portal.Click onNew Application and give your bot a name.

New ApplicationCreate Application

Then you should be redirected to the application page. Click onBot in the sidebar.Bot

Great, now we are on the page where we can manage our bot; on this page you canchange the username, avatar and banner of your bot. You can also set your bot tobe private (recommended but not required).

In order for Reaction-Role to run on your bot we need the token, initially notoken will be known, so we need to reset it. This token is very important andshould be kept secret. If you ever think your token has been compromised, or youhave lost it, you can just reset it here.

Reset Bot TokenCopy the token and save it somewhere safe (we will need this for the configuration)

Our last step is to ensure the bot has the correct Discord intents enabled.We can just do this by scrolling down in the bot page and enable all intents.(or the ones that apply) Remember to save your changes.Intents

Configuring the bot

Setting up the bot is easy, in the config directory you will find*.example.yaml files. Make sure to copy each of these files to a new filewithout the.example extension.

About the config files

  • ./config/config.yaml - Contains all bot configuration
  • ./config/lang.yaml - Contains all language strings (this is what the botsends for messages)

Bot Authentication

The bot requires a token to authenticate with Discord.(seeCreating a bot and finding your token)

There are two ways to provide the bot with the token, either through anenvironment variable or through the config file.

If you don't know what an environment variable is, you can just use it in theconfig file and settoken_env_enabled tofalse.

token_env_enabled:falsetoken:"XXXYOURBOTTOKENHEREXXX"

If you want to use environment variables, you can set thetoken_env_enabled totrue and set the key of the environment variable in thetoken_env field..env files will also be loaded automatically.

Configuring the reaction roles

In the config, you will find a key calledreaction_roles. This key contains alisting of messages that it will watch for reactions.

On each message you can define several emoji's and their role (id) that shouldbe given if someone reacts to it using that emoji.

For custom emoij's use the emoij id.

How to obtain a message and role id?

In your Discord client, enable developer mode(settings -> advanced). Now goto the message that you want to use and right click on the message. You shouldsee a new option calledCopy ID. This will copy the message id to yourclipboard. Which you can then paste in the config file.

For role id's, you can do the same but on the role in the server settings or ona user profile.

Running the bot (Docker)

Now that you have your bot token, you can use the provided docker compose fileto easily get your bot up and running.

In the project directory(where thedocker-compose.yml file is located), runthe following command:

docker compose up

If you have just pulled an updated version of the bot, you might want to rebuildthe image:

docker compose up --build

Running in the background

To run the bot in the background, you can use the-d flag:

docker compose up -d

Running from source

This bot is written in Rust, so you will need to have Rust installed on yoursystem. OpenSSL is also required for the bot to work. If you are using theNix package manager, you can load theflake.nix file.

Once all dependencies are installed, you can run the bot with the following

cargo run --release

Migrating from the Python version

BEFORE MIGRATING, MAKE SURE TO TURN OFF THE BOT AND BACKUP YOURdb FOLDER IFPRESENT!

The only change required is in the config.Make the.py and.cfg files to the expected YAML format.All data will keep working.

Why moving to Rust?

Rust provides a more stable development environment and is just my preferredlanguage. As an added bonus, it's faster and more efficient than Python.

Why moving to YAML?

The YAML format is language independent and is easier to read and write.This change allows for more flexibility in the configuration and for apotentional future where the bot is rewritten in another language.

Having issues?

Pleasecreate an issueor joinour discord and I'll help you out!

Support this project

If you like this work, you can support me by buying me a coffee!paypal.me/ArthurDeWitte

Special thanks

Special thanks tocombatmedic02 for supporting me in this project ♥


[8]ページ先頭

©2009-2025 Movatter.jp