#slash-command #twilight #discord

twilight-interactions

简化 Discord Interactions 使用 Twilight 的宏和实用工具

21 个版本

0.16.0-rc.12024年5月16日
0.15.2 2023年6月23日
0.15.1 2023年3月26日
0.14.2 2022年11月27日
0.7.2 2021年11月23日

439网页编程 类别中

Download history 66/week @ 2024-04-27 65/week @ 2024-05-04 151/week @ 2024-05-11 101/week @ 2024-05-18 70/week @ 2024-05-25 62/week @ 2024-06-01 104/week @ 2024-06-08 51/week @ 2024-06-15 66/week @ 2024-06-22 6/week @ 2024-06-29 14/week @ 2024-07-06 20/week @ 2024-07-13 22/week @ 2024-07-20 81/week @ 2024-07-27 32/week @ 2024-08-03 37/week @ 2024-08-10

每月下载量:174

ISC 许可证

61KB
829

Twilight interactions

Crates.io dependency status docs.rs CI

twilight-interactions 是一个宏和实用工具集合,用于使用 twilight 与 Discord Interactions 一起工作。

注意: 此包与 twilight 项目无关。

功能

  • 斜杠命令解析:使用 CommandModel 宏将交互数据解析为类型化结构体。
  • 斜杠命令创建:使用 CreateCommand 宏从您的结构体中创建命令。命令通过属性进行配置。
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>
}

安装

要安装 twilight-interactions,请将以下内容添加到您的 Cargo.toml

[dependencies]
twilight-interactions = "0.15"

该包的主版本号遵循官方 Twilight 包的版本。当前的最小支持 Rust 版本(MSRV)是 1.67

文档

API 文档可在 docs.rs 上找到:[twilight-interactions 文档](https://docs.rs/twilight-interactions/)

示例可在 examples 目录中找到。

贡献

没有特定的贡献指南,欢迎提交新 PR 以改进代码。如果您想引入新功能,请先创建一个 issue。

特别感谢 LeSeulArtichaut,他首先参与了此项目。

依赖关系

~3.5MB
~74K SLoC