#discord #discord-bot #channel #notifications #send-notifications #notify

bin+lib discord_notify

A Rust library to send notifications to Discord channels

2 unstable releases

new 0.2.0 Feb 8, 2025
0.1.0 Feb 2, 2025

#1693 in Web programming

Download history 104/week @ 2025-01-29 142/week @ 2025-02-05

246 downloads per month

MIT license

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
~285K SLoC