ReOrg: TODO: Init per guild join timer

This commit is contained in:
2023-03-03 17:30:00 -05:00
parent 5bb7a558f4
commit 4106f2f99c
4 changed files with 56 additions and 55 deletions

23
src/events.rs Normal file
View File

@@ -0,0 +1,23 @@
use serenity::async_trait;
use serenity::model::gateway::Ready;
use serenity::prelude::Context;
use serenity::prelude::*;
pub struct Handler;
#[async_trait]
impl EventHandler for Handler {
// Set a handler to be called on the `ready` event. This is called when a
// shard is booted, and a READY payload is sent by Discord. This payload
// contains data like the current user's guild Ids, current user data,
// private channels, and more.
//
// In this case, just print what the current user's username is.
async fn ready(&self, ctx: Context, ready: Ready) {
println!("{} is connected!", ready.user.name);
for g_id in ctx.cache.guilds() {
let g = ctx.cache.guild(g_id).expect("Unable to fetch guild");
println!("Initializing {}...", g.name);
}
}
}