summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs25
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?;