#twilight #discord #slash-command

twilight-interactions

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

6 releases

Uses new Rust 2021

new 0.9.0 Jan 24, 2022
0.8.1 Dec 21, 2021
0.7.2 Nov 23, 2021
0.7.0 Oct 28, 2021

#93 in Parser tooling

Download history 17/week @ 2021-10-25 20/week @ 2021-11-08 8/week @ 2021-11-15 32/week @ 2021-11-22 23/week @ 2021-11-29 22/week @ 2021-12-06 86/week @ 2021-12-13 66/week @ 2021-12-20 18/week @ 2021-12-27 16/week @ 2022-01-03 13/week @ 2022-01-10 13/week @ 2022-01-17

64 downloads per month

ISC license

44KB
585 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.9"

The crate major version follow the version of the official twilight crates. The MSRV is two version behind the latest stable version (current is 1.57) and can be bumped in minor updates.

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

~3MB
~68K SLoC