Skip to content

Commit

Permalink
Prevent bot from talking to itself
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Apr 23, 2024
1 parent cbeaf63 commit bd73251
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/commands/say.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serenity::model::prelude::*;
use serenity::prelude::*;

#[command]
#[allowed_roles("Moderator", "Admin")]
#[owners_only]
#[only_in("guild")]
async fn say(ctx: &Context, msg: &Message) -> CommandResult {
let message = msg.content.replace("~say ", "");
Expand Down
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ impl EventHandler for Handler {
}
}

if msg.content.contains("fortnite") {
let _ = msg.reply_ping(&context, "no.").await;
}
if !msg.author.bot {
if msg.content.contains("fortnite") {
let _ = msg.reply_ping(&context, "no.").await;
}

if msg.content.contains("Fortnite") {
let _ = msg.reply_ping(&context, "no.").await;
if msg.content.contains("Fortnite") {
let _ = msg.reply_ping(&context, "no.").await;
}
}
}

Expand Down

0 comments on commit bd73251

Please sign in to comment.