Metacinnabar / reaction-roles

Discord reaction role bot implementation in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reaction-roles

wakatime GitHub repo size Lines of code GitHub license GitHub lastest commit

Overview

Discord reaction role bot implementation in Rust.
Built with serenity.

- This is my first time using Rust, so this code likely won't have the best practices in it.
- If you found reaction-roles helpful or neat please consider leaving a star โญ

Usage

- Assuming Rust is installed.

  • Clone the repository (git clone https://github.com/Metacinnabar/reaction-roles.git && cd reaction-roles)
  • Rename example.env to .env (mv example.env .env)
  • Edit .env following dotenv (nano .env)
  • Edit config.json following configuration (nano config.json)
  • Run the bot with cargo (cargo run)

Dotenv

Example .env file:

DISCORD_TOKEN=TOKEN
RUST_LOG=INFO

DISCORD_TOKEN - Discord bot token for your bot

RUST_LOG - Console logging level (ERROR, INFO, DEBUG)

Configuration

Example config.json file:

{
  "message_id": 884599663049313832,
  "emotes": [
    "<:customemotename:884597154617730385>",
    "๐Ÿ˜ƒ"
  ],
  "role_ids": [
    884597587997503708,
    884597734784564692
  ]
}

The first entry in emotes matches the first entry in role_ids.

key desc value example
message_id message id for reaction roles 884599663049313832
emotes array of emote ids or unicode for emotes (fetched with /:emote:) [ "<:emotename:884597154617730385>", "๐Ÿ˜ƒ" ]
role_ids array of role ids [ 884597587997503708, 884597734784564692 ]

Todo

  • Json config for message id, emotes, and roles
  • Generalize & modularize code
  • Properly log events to console
  • (Optional config) Log reactions to a channel
  • (Optional config) DM the user who reacted
  • Multiple server support
  • Commands to add reaction roles

Support

For any bug reports, questions, or requests please create an issue via the issue tracker.

License

reaction-roles is licensed under the MIT License.

About

Discord reaction role bot implementation in Rust.

License:MIT License


Languages

Language:Rust 95.1%Language:Shell 4.9%