17 lines
499 B
Rust
17 lines
499 B
Rust
use crate::config::AlbatrossConfig;
|
|
use discord_hooks_rs::DiscordWebhook;
|
|
|
|
/// Sends a webhook to Discord if its configured
|
|
///
|
|
/// # Params
|
|
/// * `msg` - Message to send to discord
|
|
/// * `cfg` - Albatross config
|
|
pub fn send_webhook(msg: &str, cfg: &AlbatrossConfig) {
|
|
if let Some(webhook) = &cfg.backup.discord_webhook {
|
|
let json = DiscordWebhook::new().content(msg);
|
|
|
|
let client = reqwest::blocking::Client::new();
|
|
client.post(webhook).json(&json).send().ok();
|
|
}
|
|
}
|