Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baptiste0928/twilight-interactions
Macros and utilities to work with Discord Interactions using twilight.
https://github.com/baptiste0928/twilight-interactions
discord rust twilight-rs
Last synced: 9 days ago
JSON representation
Macros and utilities to work with Discord Interactions using twilight.
- Host: GitHub
- URL: https://github.com/baptiste0928/twilight-interactions
- Owner: baptiste0928
- License: isc
- Created: 2021-09-06T08:28:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-16T00:22:24.000Z (8 months ago)
- Last Synced: 2024-12-07T05:12:27.798Z (21 days ago)
- Topics: discord, rust, twilight-rs
- Language: Rust
- Homepage:
- Size: 228 KB
- Stars: 37
- Watchers: 1
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Twilight interactions
[![Crates.io](https://img.shields.io/crates/v/twilight-interactions)](https://crates.io/crates/twilight-interactions)
[![dependency status](https://deps.rs/repo/github/baptiste0928/twilight-interactions/status.svg)](https://deps.rs/repo/github/baptiste0928/twilight-interactions)
[![docs.rs](https://img.shields.io/docsrs/twilight-interactions)](https://docs.rs/twilight-interactions/)
[![CI](https://github.com/baptiste0928/twilight-interactions/actions/workflows/ci.yaml/badge.svg?event=push)](https://github.com/baptiste0928/twilight-interactions/actions/workflows/ci.yaml)`twilight-interactions` is a set of macros and utilities to work with Discord Interactions using [`twilight`](https://github.com/twilight-rs/twilight).
**Note:** This crate is not affiliated with the [`twilight`](https://github.com/twilight-rs/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.```rust
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
}
```## Installing
To install `twilight-interactions`, add the following to your `Cargo.toml`:```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](https://docs.rs/twilight-interactions/).
Examples are available in the [`examples`](https://github.com/baptiste0928/twilight-interactions/tree/main/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](https://github.com/LeSeulArtichaut) who worked the first on this project.*