diff options
| author | seth <[email protected]> | 2023-11-16 22:55:58 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-11-18 01:42:03 +0000 |
| commit | d29e3a532871ca4588c4574352014659bb721140 (patch) | |
| tree | 1e2d99b76621ab2276a308104b75699d04b25e0c /src/main.rs | |
| parent | 5cdfccd11a64ff4fcf8560910bb1580acec9b26a (diff) | |
fix: set more appropriate intents
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 25 |
1 files changed, 14 insertions, 11 deletions
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<PinBoard>, } -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?; |
