#discord-twilight #slash-command #twilight #discord

twilight-interactions

Macros and utilities to make Discord Interactions easy to use with Twilight

24 releases

new 0.16.2 Mar 25, 2025
0.16.0-rc.1 May 16, 2024
0.15.2 Jun 23, 2023
0.15.1 Mar 26, 2023
0.7.2 Nov 23, 2021

#308 in Web programming

Download history 231/week @ 2024-12-08 70/week @ 2024-12-15 20/week @ 2024-12-22 147/week @ 2024-12-29 130/week @ 2025-01-05 217/week @ 2025-01-12 145/week @ 2025-01-19 262/week @ 2025-01-26 137/week @ 2025-02-02 209/week @ 2025-02-09 169/week @ 2025-02-16 185/week @ 2025-02-23 143/week @ 2025-03-02 71/week @ 2025-03-09 69/week @ 2025-03-16 155/week @ 2025-03-23

494 downloads per month

ISC license

62KB
840 lines

Twilight interactions

Crates.io dependency status docs.rs CI

twilight-interactions is a set of macros and utilities to work with Discord Interactions using twilight.

Note: This crate is not affiliated with the twilight project.

Features

  • Slash command parsing: parse interaction data as typed structs using the CommandModel macro.
  • Slash command creation: create commands from your structs with the CreateCommand macro. Commands are configured using attributes.
use twilight_interactions::command::{CommandModel, CreateCommand, ResolvedUser};

#[derive(CommandModel, CreateCommand)]
#[command(name = "hello", desc = "Say hello to other members")]
struct HelloCommand {
    /// Message to send
    message: String,
    /// User to send the message to
    user: Option<ResolvedUser>
}

Installing

To install twilight-interactions, add the following to your Cargo.toml:

[dependencies]
twilight-interactions = "0.16"

The crate's major version follows the version of the official twilight crates. The current MSRV is 1.79.

Documentation

The API documentation is available on docs.rs: twilight-interactions documentation.

Examples are available in the examples directory.

Contributing

There is no particular contribution guidelines, feel free to open a new PR to improve the code. If you want to introduce a new feature, please create an issue before.

Special thanks to LeSeulArtichaut who worked the first on this project.

Dependencies

~3.5MB
~75K SLoC