aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs
index 38a849b..de322ae 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,12 +5,16 @@
* This iteration will focus on code correctness and durability. The major goal is to avoid what
* happened to the Campmaster by avoiding code rot and forcing documentation on _everything_
*/
+#[macro_use]
+extern crate tracing;
use std::{sync::Mutex, time::Duration};
use dotenv::dotenv;
use sqlx::{postgres::PgPoolOptions, PgPool};
use tracing::{info, instrument};
+use poise::serenity_prelude as serenity;
+
type Error = Box<dyn std::error::Error + Send + Sync>;
type Context<'a> = poise::Context<'a, Data, Error>;
@@ -43,14 +47,14 @@ async fn on_error(error: poise::FrameworkError<'_, Data, Error>) {
match 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))
+ error!("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 {
- println!("Error handling error: {}", e);
+ error!("Error handling error: {}", e);
}
}
}
@@ -81,11 +85,7 @@ async fn main() {
commands::meta::ping(),
commands::meta::about(),
commands::meta::userinfo(),
- commands::actions::boop(),
- commands::actions::hug(),
- commands::pony::randpony(),
- commands::pony::tpony(),
- commands::pony::ponybyid(),
+ commands::actions::boop(), commands::actions::hug(), commands::pony::randpony(), commands::pony::tpony(), commands::pony::ponybyid(),
commands::osu::osup(),
commands::osu::osubm(),
poise::Command {
@@ -100,6 +100,8 @@ async fn main() {
subcommands: vec![
commands::filters::list(),
commands::filters::add(),
+ commands::filters::del(),
+ commands::filters::channel(),
],
..commands::filters::filter()
},
@@ -109,12 +111,12 @@ async fn main() {
// Honestly could probably be removed, but it's kept in for ~reasons~
pre_command: |ctx| {
Box::pin(async move {
- println!("Executing command {}...", ctx.command().name);
+ debug!("Executing command {}...", ctx.command().name);
})
},
post_command: |ctx| {
Box::pin(async move {
- println!("Done executing command {}!", ctx.command().name);
+ debug!("Done executing command {}!", ctx.command().name);
})
},
@@ -136,6 +138,9 @@ async fn main() {
poise::Framework::build()
.token(std::env::var("DISCORD_TOKEN").unwrap_or("BAD-TOKEN".into()))
+ .client_settings(|c| {
+ c.intents(serenity::GatewayIntents::all())
+ })
.user_data_setup(move |_ctx, _ready, _framework| {
Box::pin(async move {
/*