6 个稳定版本
2.1.2 | 2022 年 12 月 13 日 |
---|---|
2.1.1 | 2022 年 9 月 12 日 |
2.0.0 | 2021 年 12 月 15 日 |
1.0.1 | 2020 年 7 月 18 日 |
#1214 in 网页编程
695 每月下载量
在 3 crates 中使用
32KB
831 行
示例用法
使用应用程序 Webhook,您还可以创建消息组件(目前只有按钮)。要查看完整示例,请参阅 examples/example.rs
。
let url: &str = "Webhook URL";
let client: WebhookClient = WebhookClient::new(url);
client.send(|message| message
.username("Thoo")
.avatar_url(IMAGE_URL)
.embed(|embed| embed
.title("Webhook")
.description("Hello, World!")
.footer("Footer", Some(String::from(IMAGE_URL)))
.image(IMAGE_URL)
.thumbnail(IMAGE_URL)
.author("Lmao#0001", Some(String::from(IMAGE_URL)), Some(String::from(IMAGE_URL)))
.field("name", "value", false))).await?;
开始使用
要开始使用,请简单地将 crate 添加到您的 Cargo.toml
文件中。
[dependencies]
webhook = "2.1.1"
如果您只想使用类型,您可以使用功能 models
来消除与网络相关的依赖。
[dependencies]
webhook = { version = "2.1.1", features = ["models"] }
待办事项
- 附件
- 组件
贡献
任何类型的贡献都备受赞赏。
依赖
~0.6–13MB
~158K SLoC