use serenity::{ all::{Message, Ready}, async_trait, client::{Context, EventHandler}, }; pub struct Handler; #[async_trait] impl EventHandler for Handler { async fn message(&self, ctx: Context, msg: Message) { if msg.author.bot { return; } if msg.content == "!ping" { if let Err(why) = msg.channel_id.say(&ctx.http, "Pong!").await { println!("Error sending message: {:?}", why); } return; } } async fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } }