diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index bfd39c7..2968f20 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use std::{sync::Mutex, time::Duration}; use dotenv::dotenv; use sqlx::{postgres::PgPoolOptions, PgPool}; +use tracing::{info, instrument}; type Error = Box<dyn std::error::Error + Send + Sync>; type Context<'a> = poise::Context<'a, Data, Error>; @@ -34,6 +35,9 @@ async fn on_error(error: poise::FrameworkError<'_, Data, Error>) { poise::FrameworkError::Setup { error } => panic!("Failed to start bot: {:?}", error), poise::FrameworkError::Command { error, ctx } => { println!("Error in command {}: {:?}", ctx.command().name, error); + ctx.say(format!("Whoops! Something went wrong: {:?}", error)) + .await + .unwrap(); } error => { if let Err(e) = poise::builtins::on_error(error).await { @@ -54,8 +58,11 @@ async fn register(ctx: Context<'_>, #[flag] global: bool) -> Result<(), Error> { } #[tokio::main] +#[instrument] async fn main() { dotenv().unwrap(); + tracing_subscriber::fmt::init(); + info!("Initialized logging"); let options = poise::FrameworkOptions { commands: vec![ help(), @@ -67,10 +74,15 @@ async fn main() { commands::actions::hug(), commands::pony::randpony(), commands::pony::tpony(), + commands::pony::ponybyid(), commands::osu::osup(), commands::osu::osubm(), poise::Command { - subcommands: vec![commands::reactionroles::init(), commands::reactionroles::add(), commands::reactionroles::del(),], + subcommands: vec![ + commands::reactionroles::init(), + commands::reactionroles::add(), + commands::reactionroles::del(), + ], ..commands::reactionroles::rroles() }, ], |