Trying to catch why my bot is getting disconnected after a few hours

This commit is contained in:
Oupson 2020-08-26 12:14:01 +02:00
parent cb378dd042
commit e1c2710a3b
1 changed files with 7 additions and 2 deletions

View File

@ -7,7 +7,7 @@ use crate::commands::{
use async_trait::async_trait; use async_trait::async_trait;
use serde_json::Value; use serde_json::Value;
use serenity::{ use serenity::{
client::bridge::gateway::ShardManager, client::bridge::gateway::{event::ShardStageUpdateEvent, ShardManager},
framework::standard::{ framework::standard::{
help_commands, help_commands,
macros::{help, hook}, macros::{help, hook},
@ -155,7 +155,7 @@ async fn main() -> IoResult<()> {
}) })
} }
client.start().await.unwrap(); client.start_autosharded().await.unwrap();
Ok(()) Ok(())
} }
@ -200,6 +200,7 @@ impl Messages {
}*/ }*/
} }
#[async_trait] #[async_trait]
impl EventHandler for Messages { impl EventHandler for Messages {
async fn reaction_add(&self, _ctx: Context, reaction: Reaction) { 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) { async fn ready(&self, ctx: Context, ready: Ready) {
println!("{} connected to discord", ready.user.name); println!("{} connected to discord", ready.user.name);