Added pushover notification sending

This commit is contained in:
rzuasti
2026-01-23 10:25:45 -05:00
parent 8e8460afbc
commit 77f996c591
6 changed files with 111 additions and 19 deletions
+27
View File
@@ -0,0 +1,27 @@
use log::{debug, error};
use pushover::API;
use pushover::requests::message::SendMessage;
use crate::settings::CONFIG;
pub fn send_message(body: String) -> Result<(), String> {
debug!("About to send message via pushover ({body})");
let api = API::new();
let msg = SendMessage::new(
CONFIG.notifications.pushover.token.as_str(),
CONFIG.notifications.pushover.user_key.as_str(),
body,
);
match api.send(&msg) {
Ok(_) => {
debug!("Message sent successfully");
Ok(())
}
Err(error) => {
error!("Error sending message via pushover: {error}");
Err(format!("Error sending message via pushover: {error}"))
}
}
}