Skip to content

Commit

Permalink
Fix bug causing bot to reply to its own messages in event_handler exa…
Browse files Browse the repository at this point in the history
…mple (#251)
  • Loading branch information
Spacerulerwill authored Mar 17, 2024
1 parent 9def484 commit 48b0318
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/event_handler/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ async fn event_handler(
println!("Logged in as {}", data_about_bot.user.name);
}
serenity::FullEvent::Message { new_message } => {
if new_message.content.to_lowercase().contains("poise") {
if new_message.content.to_lowercase().contains("poise")
&& new_message.author.id != ctx.cache.current_user().id
{
let old_mentions = data.poise_mentions.fetch_add(1, Ordering::SeqCst);
new_message
.reply(
Expand Down

0 comments on commit 48b0318

Please sign in to comment.