Expand description
§Discord Notification Sender
A simple library for sending notifications to Discord channels using a Discord bot.
§Example
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);
}
// Advanced notification with embeds
if let Err(e) = bot.send_advanced_notification(
"Title",
"Message content",
0x3498db, // Blue color
Some("https://example.com/image.png")
).await {
eprintln!("Failed to send advanced notification: {}", e);
}
}