#twilight #slash-command #discord

macro twilight-interactions-derive

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

21 releases

new 0.16.0-rc.1 May 16, 2024
0.15.2 Jun 23, 2023
0.15.1 Mar 26, 2023
0.14.2 Nov 27, 2022
0.7.2 Nov 23, 2021

#25 in #twilight

Download history 19/week @ 2024-01-24 9/week @ 2024-01-31 86/week @ 2024-02-07 81/week @ 2024-02-14 52/week @ 2024-02-21 130/week @ 2024-02-28 96/week @ 2024-03-06 76/week @ 2024-03-13 69/week @ 2024-03-20 68/week @ 2024-03-27 109/week @ 2024-04-03 220/week @ 2024-04-10 96/week @ 2024-04-17 82/week @ 2024-04-24 61/week @ 2024-05-01 68/week @ 2024-05-08

486 downloads per month
Used in twilight-interactions

ISC license

71KB
1.5K SLoC

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.15"

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

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

~305–760KB
~18K SLoC