aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-01-19 20:14:50 -0500
committerCara Salter <cara@devcara.com>2022-01-19 20:14:50 -0500
commit943196546dc3f9b5cc4356cebb8468775a127471 (patch)
tree35d826e3271bd7aece9aa394cd44542bb7f69a9f /src/main.rs
parent7d868aedd1147c484d82ea4815c5c53af834eacb (diff)
downloadglitch-ng-943196546dc3f9b5cc4356cebb8468775a127471.tar.gz
glitch-ng-943196546dc3f9b5cc4356cebb8468775a127471.zip
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 <cara@devcara.com>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
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()
},
],