Crates.io | discord_notify |
lib.rs | discord_notify |
version | 0.2.0 |
source | src |
created_at | 2025-02-02 10:11:44.88643 |
updated_at | 2025-02-08 11:04:32.632621 |
description | A Rust library to send notifications to Discord channels. |
homepage | |
repository | |
max_upload_size | |
id | 1539444 |
size | 584,391 |
A simple discord bot struct in Rust that just sends notifications on a channel ID.
use discord_notify::DiscordBot;
#[tokio::main]
async fn main() {
// Ensure you have a .env file with a valid DISCORD_TOKEN
let channel_id = "<YOUR CHANNEL ID>";
let identifier = "My Discord Bot";
let bot = DiscordBot::new(identifier, channel_id);
if let Err(e) = bot.send_notification("Hello from the Discord Notification Sender!").await {
eprintln!("Failed to send notification: {}", e);
}
}