From 943196546dc3f9b5cc4356cebb8468775a127471 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Wed, 19 Jan 2022 20:14:50 -0500 Subject: pony: Add ponybyid Required adding the derpi ID to the footer of all the other pony embeds TODO: Refactor generating the pony embeds out of the commands Signed-off-by: Cara Salter --- src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main.rs') 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; 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() }, ], -- cgit v1.2.3