diff options
| author | Nathan Perry <np@nathanperry.dev> | 2020-09-26 15:39:41 -0400 |
|---|---|---|
| committer | Nathan Perry <np@nathanperry.dev> | 2020-09-26 15:39:41 -0400 |
| commit | c12afcf2f06d2d477348952692bf4662ff9ce779 (patch) | |
| tree | b9ac4c812948f22ed48580c3194dc0b2cf22f734 | |
| parent | 2b2e41f165b4a42b5ea98ba282548b9eb1d92070 (diff) | |
add more event handlers, better logging
| -rw-r--r-- | src/bot.rs | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -13,6 +13,7 @@ use serenity::{ MessageId, }, channel::Message, + event::ResumedEvent, }, framework::StandardFramework, }; @@ -22,6 +23,7 @@ use fnv::{ FnvHashSet, }; +use serde_json::Value; use chrono::Datelike; use lazy_static::lazy_static; use log::{ @@ -50,8 +52,11 @@ impl EventHandler for Handler { if guild.is_none() { info!("bot isn't in configured guild. join here: {:?}", OAUTH_URL.as_str()); + return; } + info!("connected"); + #[cfg(debug_assertions)] let botname = "thulani (dev)"; @@ -65,11 +70,19 @@ impl EventHandler for Handler { }); } + fn resume(&self, _ctx: Context, _resume: ResumedEvent) { + info!("reconnected to discord"); + } + fn message_delete(&self, _ctx: Context, _channel_id: ChannelId, deleted_message_id: MessageId) { MESSAGE_WATCH.lock() .unwrap() .remove(&deleted_message_id); } + + fn unknown(&self, _ctx: Context, name: String, _raw: Value) { + info!("unknown event: {:?}", name); + } } lazy_static! { |
