#discord #serenity #utilities #rust


A library to provide additional utilies for Discord bots created with serenity

8 releases (5 breaking)

0.6.1 Feb 1, 2021
0.6.0 Jan 10, 2021
0.5.1 Nov 28, 2020
0.5.0 Aug 30, 2020
0.1.0 Aug 17, 2020

#189 in Web programming

Download history 36/week @ 2021-08-11 51/week @ 2021-08-18 31/week @ 2021-08-25 3/week @ 2021-09-01 19/week @ 2021-09-08 10/week @ 2021-09-15 6/week @ 2021-09-22 16/week @ 2021-09-29 12/week @ 2021-10-06 23/week @ 2021-10-13 18/week @ 2021-10-20 17/week @ 2021-10-27 18/week @ 2021-11-03 12/week @ 2021-11-10 10/week @ 2021-11-17 11/week @ 2021-11-24

53 downloads per month

ISC license



docs badge crates.io badge license badge rust 1.39.0+ badge

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:

serenity_utils = "0.6.1"

Note: This crate only supports serenity's async versions and a minimum of Rust 1.39.


Here are a few examples to use some of serenity_utils's features.

Reaction Prompt

use serenity::{
   model::prelude::{ChannelId, Message, ReactionType},
use serenity_utils::{prompt::reaction_prompt, Error};

async fn prompt(ctx: &Context, msg: &Message) -> Result<(), Error> {
    // Emojis for the prompt.
    let emojis = [

    let prompt_msg = ChannelId(7).say(&ctx.http, "Dogs or cats?").await?;

    // Creates the prompt and returns the result. Because of `reaction_prompt`'s
    // return type, you can use the `?` operator to get the result.
    // The `Ok()` value is the selected emoji's index (wrt the `emojis` slice)
    // and the emoji itself. We don't require the emoji here, so we ignore it.
    let (idx, _) = reaction_prompt(

    if idx == 0 {
        // Dogs!
    } else {
        // Cats!



use serenity::{
use serenity_utils::{
    menu::{Menu, MenuOptions},

async fn use_menu(ctx: &Context, msg: &Message) -> Result<(), Error> {
    let mut page_one = CreateMessage::default();
        .content("Page number one!")
        .embed(|e| {
            e.description("The first page!");


    let mut page_two = CreateMessage::default();
        .content("Page number two!")
        .embed(|e| {
            e.description("The second page!");


    let pages = [page_one, page_two];

    // Creates a new menu.
    let menu = Menu::new(ctx, msg, &pages, MenuOptions::default());

    // Runs the menu and returns optional `Message` used to display the menu.
    let opt_message = menu.run().await?;


More Examples

More examples detailing the crate's functionality can be found in the examples directory.


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 cache feature. It is required to get Member from user name, tag or nickname when using the Conversion trait.
  • rustls_backend: Uses Rustls for all platforms, a pure Rust implementation.
  • native_tls_backend: Uses SChannel on Windows, Secure Transport on macOS, and OpenSSL on other platforms.
  • rustls_tokio_0_2_backend: Same as rustls_backend but uses tokio 0.2.
  • native_tls_tokio_0_2_backend: Same as native_tls but uses tokio 0.2.

cache and rustls_backend are enabled by default.

  • default_native_tls: Enables default serenity_utils features with native_tls_backend.
  • default_tokio_0_2: Enables default serenity_utils features using tokio 0.2.
  • default_native_tls_tokio_0_2: Enables default serenity_utils features with native_tls_backend using tokio 0.2.

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:

version = "0.6.1"

# To disable default features.
default-features = false

# Choose features you need.
features = ["cache", "native_tls_backend"]


serenity_utils is available under the ISC license. See LICENSE for more details.


~267K SLoC