2 unstable releases
0.2.0 | Feb 8, 2025 |
---|---|
0.1.0 | Feb 2, 2025 |
#19 in #send-notifications
246 downloads per month
545KB
102 lines
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);
}
}
lib.rs
:
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);
}
}
Dependencies
~9–21MB
~278K SLoC