From e1c2710a3b19097744b936d8f57df80907484c2a Mon Sep 17 00:00:00 2001 From: Oupson Date: Wed, 26 Aug 2020 12:14:01 +0200 Subject: [PATCH] Trying to catch why my bot is getting disconnected after a few hours --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6e073b9..fee62b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use crate::commands::{ use async_trait::async_trait; use serde_json::Value; use serenity::{ - client::bridge::gateway::ShardManager, + client::bridge::gateway::{event::ShardStageUpdateEvent, ShardManager}, framework::standard::{ help_commands, macros::{help, hook}, @@ -155,7 +155,7 @@ async fn main() -> IoResult<()> { }) } - client.start().await.unwrap(); + client.start_autosharded().await.unwrap(); Ok(()) } @@ -200,6 +200,7 @@ impl Messages { }*/ } + #[async_trait] impl EventHandler for Messages { async fn reaction_add(&self, _ctx: Context, reaction: Reaction) { @@ -210,6 +211,10 @@ impl EventHandler for Messages { }*/ } + async fn shard_stage_update(&self, _ctx: Context, s: ShardStageUpdateEvent) { + println!("Shard stage update : {:?}",s ); + } + async fn ready(&self, ctx: Context, ready: Ready) { println!("{} connected to discord", ready.user.name);