This repository is a non-published Rust crate that has the common code used by my Discord bots.
Although the code itself is very opinionated, feel free to fork the project and adjust it however you wish.
Has a method to create commands for the given guild or globally based on the build configuration.
Provides a trait to handle the interaction, which is meant to be implemented on each interaction's struct.
The trait's provided handle
method sets up automatic deferring, runs the interaction, and handles the error by
reporting it to the user.
Supports Fluent to localize the bot's messages with a locale struct for abstract default language fallback and a function to return Fluent messages in Discord-compatible value pairs.
All user-facing texts used in this crate are also localized.
Includes a command that users can use to provide feedback, which uses Sentry to report the feedback.
Users can also provide feedback with the button attached to the interaction error message.
Has a function to set up tracing with a formatter, environment filtering, Sentry support, and log crate compatibility.
Provides a trait to convert an Option
to a Result
concisely. This is here because the Discord API returns many
optional values.
Provides methods to handle the ready event, as well as errors that occur while handling or receiving an event.
Allows you to use Discord-defined colors with an enum the crate provides.