ReOrg: TODO: Init per guild join timer
This commit is contained in:
23
src/events.rs
Normal file
23
src/events.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user