Files
New-Alan/src/events.rs
DavidCrompton1192@gmail.com 940d6ca512 Cycling Join
Yeeeessh, cyyclic async functions are weird.
2023-03-11 22:39:12 -05:00

28 lines
885 B
Rust

use serenity::async_trait;
use serenity::model::gateway::Ready;
use serenity::model::prelude::Guild;
use serenity::prelude::Context;
use serenity::prelude::*;
use crate::utils::*;
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);
}
async fn guild_create(&self, ctx: Context, guild: Guild, _new: bool) {
println!("Guild joined: {}", guild.name);
guild_popin::add_guild(ctx, guild).await;
}
}