serenity-utils
A library to provide conversions, prompts and menu functionality for Discord bots created with serenity.
This library provides implementations to easily:
- Convert a string to serenity's guild-specific models.
- Get user response using message or reaction prompts.
- Display paginated reaction-based messages/menus.
- Format text in different ways before sending.
- Create embeds and messages with field access.
Installation and Usage
To use this crate, add the following to your Cargo.toml
:
[]
= "0.4.0"
Note: This crate only supports serenity's async versions and a minimum of Rust 1.39.
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: It is required to get
Member
from user name, tag or nickname when using theConversion
trait. - rustls_backend: Uses
Rustls
for all platforms, a pure Rust implementation. - native_tls_backend: Uses
SChannel
on Windows,Secure Transport
on macOS, andOpenSSL
on other platforms.
They enable serenity's features with the same names.
Note: One of rustls_backend
and native_tls_backend
must be used.
cache and rustls_backend are enabled by default.
You can specify features by adding this to your Cargo.toml
:
[]
= "0.4.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.