serenity-utils
A library to provide conversions, prompts and menu functionality for Discord bots created with serenity.
This library provides implementations to easily:
- Get user response using message or reaction prompts.
- Display paginated reaction-based messages/menus.
- Format text in different ways before sending.
Convert a string to serenity's guild-specific models.(deprecated; use serenity'sArgumentConverttrait instead)Create embeds and messages with field access.(deprecated; use serenity's builder directly)
Installation and Usage
To use this crate, add the following to your Cargo.toml:
[]
= "0.7.0"
Note: This crate only supports serenity's async versions and a minimum of Rust 1.53 (consistent with the latest serenity version).
Examples
Here are a few examples to use some of serenity_utils's features.
Reaction Prompt
use ;
use ;
async
Menu
use ;
use ;
async
More Examples
More examples detailing the crate's functionality can be found in the examples directory.
Features
Some functionality of this crate is dependent on serenity's features.
The following serenity features are required when using serenity_utils:
- client
- collector
- gateway
- model
The following serenity_utils features are optional:
- cache: Enables serenity's
cachefeature. It is required to getMemberfrom user name, tag or nickname when using theConversiontrait. - rustls_backend: Uses
Rustlsfor all platforms, a pure Rust implementation. - native_tls_backend: Uses
SChannelon Windows,Secure Transporton macOS, andOpenSSLon other platforms.
cache and rustls_backend are enabled by default.
- default_native_tls: Enables default
serenity_utilsfeatures withnative_tls_backend.
They enable serenity's features with the same names.
Note: One of rustls_backend and native_tls_backend must be used.
You can specify features by adding this to your Cargo.toml:
[]
= "0.7.0"
# To disable default features.
= false
# Choose features you need.
= ["cache", "native_tls_backend"]
License
serenity_utils is available under the ISC license. See LICENSE for more details.