Menus and self deleting messages for the serenity discord framework
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trivernis c3bffd81d5 Fix MenuBuilder::build sending empty messages 2 years ago
src Fix MenuBuilder::build sending empty messages 2 years ago
.gitignore Move content from 2b-rs subcrate 3 years ago
Cargo.lock Fix deadlocking (hopefully) 2 years ago
Cargo.toml Fix deadlocking (hopefully) 2 years ago
LICENSE Fix README 3 years ago Update events available to event handler 2 years ago

Serenity Additions

This crate provides some types for rich interactions with serenity such as Menus and Ephemeral (self deleting) Messages.


You have to register the module in the serenity client builder.

use serenity::client::Client;
use serenity_additions::RegisterRichInteractions;
use serenity::prelude::GatewayIntents;

let client = Client::builder("TOKEN", GatewayIntends::default()).register_serenity_additions()


use serenity::builder::CreateMessage;
use serenity::client::Context;
use serenity::model::id::ChannelId;
use serenity_additions::menu::{MenuBuilder, Page};
use std::time::Duration;
use serenity_additions::Result;

pub async fn create_menu(
    ctx: &Context,
    channel_id: ChannelId,
) -> Result<()> {
    let mut message1 = CreateMessage::default();
    let mut message2 = CreateMessage::default();
        .build(ctx, channel_id)


Ephemeral Message

use serenity_additions::core::SHORT_TIMEOUT;
use serenity_additions::ephemeral_message::EphemeralMessage;
use serenity_additions::Result;
use serenity::client::Context;
use serenity::model::id::ChannelId;

pub async fn create_ephemeral_message(ctx: &Context, channel_id: ChannelId) -> Result<()> {
    EphemeralMessage::create(&ctx.http, channel_id, SHORT_TIMEOUT, |m| {
        m.content("Hello World")