#slash-command #twilight #discord

twilight-interactions

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

20 releases

0.15.2 Jun 23, 2023
0.15.1 Mar 26, 2023
0.15.0 Feb 7, 2023
0.14.2 Nov 27, 2022
0.7.2 Nov 23, 2021

#516 in Web programming

Download history 106/week @ 2023-12-11 44/week @ 2023-12-18 20/week @ 2023-12-25 17/week @ 2024-01-01 64/week @ 2024-01-08 58/week @ 2024-01-15 30/week @ 2024-01-22 7/week @ 2024-01-29 78/week @ 2024-02-05 63/week @ 2024-02-12 59/week @ 2024-02-19 100/week @ 2024-02-26 102/week @ 2024-03-04 80/week @ 2024-03-11 63/week @ 2024-03-18 55/week @ 2024-03-25

306 downloads per month

ISC license

56KB
769 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.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.

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