From d29e3a532871ca4588c4574352014659bb721140 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 16 Nov 2023 22:55:58 -0500 Subject: fix: set more appropriate intents --- src/main.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 462e334..7641a41 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ -use std::time::Duration; -use std::{env, error}; +use std::{error, time}; use handler::pinboard::PinBoard; use log::*; @@ -19,12 +18,6 @@ pub struct Data { pin_board: Option, } -impl Default for Data { - fn default() -> Self { - Self::new() - } -} - impl Data { pub fn new() -> Self { let pin_board = PinBoard::new(); @@ -33,6 +26,12 @@ impl Data { } } +impl Default for Data { + fn default() -> Self { + Self::new() + } +} + async fn on_error(error: poise::FrameworkError<'_, Data, Error>) { match error { poise::FrameworkError::Setup { error, .. } => panic!("failed to start bot: {error:?}"), @@ -59,7 +58,9 @@ async fn main() { }, prefix_options: poise::PrefixFrameworkOptions { prefix: Some("!".into()), - edit_tracker: Some(poise::EditTracker::for_timespan(Duration::from_secs(3600))), + edit_tracker: Some(poise::EditTracker::for_timespan(time::Duration::from_secs( + 3600, + ))), ..Default::default() }, on_error: |error| Box::pin(on_error(error)), @@ -71,8 +72,10 @@ async fn main() { let framework = poise::Framework::builder() .options(options) - .token(env::var("TOKEN").expect("couldn't find token in environment.")) - .intents(serentiy::GatewayIntents::all()) + .token(std::env::var("TOKEN").expect("couldn't find token in environment.")) + .intents( + serentiy::GatewayIntents::non_privileged() | serentiy::GatewayIntents::MESSAGE_CONTENT, + ) .setup(|ctx, _ready, framework| { Box::pin(async move { poise::builtins::register_globally(ctx, &framework.options().commands).await?; -- cgit v1.2.3