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); } } }