use std::sync::Arc; use serenity::http::Http; pub async fn send_error(_http: Arc, msg: String) -> anyhow::Result<()> { println!("ERROR: {msg}"); #[cfg(feature="RELEASE")] { use serenity::all::ChannelId; use std::process::exit; use super::security::dotenv_var; use anyhow::Context; let channel_id: String = dotenv_var("DEBUG_CHANNEL_ID").context("DEBUG_CHANNEL_ID not found in env file")?; match ChannelId::new(channel_id.parse::().unwrap()) .say(_http, msg).await { Ok(_) => { return Ok(()); } Err(_) => { exit(-1) } }; } Ok(()) } #[cfg(feature="RELEASE")] pub async fn hello(http: Arc) -> anyhow::Result<()> { use serenity::all::ChannelId; use anyhow::Context; use super::security::dotenv_var; let messages = [ "AAAAAAAAAAAAAAAAAAAA", "Henlooo", "Good day y'all!", "May have crashed...", "MOOOooo", "Heyyyyy!", "I'm baaaaack!", "Whom'st have summoned the ancient one?", ]; let num = rand::random::() % messages.len(); let channel_id: String = dotenv_var("DEBUG_CHANNEL_ID").context("DEBUG_CHANNEL_ID not found in env file")?; let channel = ChannelId::new(channel_id.parse::().unwrap()); if let Err(why) = channel.say(http, messages[num]).await { print!("Error sending message: {:?}", why); }; Ok(()) }