Crates.io | discord-rs |
lib.rs | discord-rs |
version | 0.1.1 |
source | src |
created_at | 2023-06-15 16:16:49.276883 |
updated_at | 2023-06-15 16:16:49.276883 |
description | A rust library for interacting with the Discord API in a blazingly fast way |
homepage | https://discordrs.io/ |
repository | https://github.com/BrianTiburcio/discord-rs |
max_upload_size | |
id | 891239 |
size | 70,039 |
discord-rs is a blazingly fast library for interacting with the Discord API. It provides a simple and efficient way to build Discord bots, create rich embeds, send messages, manage channels, and more.
You can add discord-rs as a dependency in your Cargo.toml
file:
[dependencies]
discord-rs = "0.1.0"
Here's a simple example of how to use discord-rs to send a message:
use discord-rs::{Client, Context, EventHandler};
struct MyHandler;
impl EventHandler for MyHandler {
fn on_message(&self, ctx: &Context, message: &Message) {
if message.content == "!hello" {
ctx.send_message(message.channel_id, "Hello, Discord!").unwrap();
}
}
}
fn main() {
let token = "YOUR_DISCORD_TOKEN";
let client = Client::new(token, MyHandler);
client.start().expect("Failed to start the client.");
}
Make sure to replace YOUR_DISCORD_TOKEN with your actual Discord bot token.
For detailed usage instructions, examples, and API reference, please refer to the Documentation
Contributions are welcome! If you find any bugs, have suggestions, or would like to contribute to the project, please check out our [Contributing Guidelines].
This project is licensed under the Apache License 2.0.