Skip to content

Commit 7e0a8e3

Browse files
committed
Dont overwrite the fix to only process edits that start with PREFIX
1 parent 72daa5c commit 7e0a8e3

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/command_history.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use crate::{Commands, Error, SendSyncError, HOUR};
1+
use crate::{
2+
commands::{Commands, PREFIX},
3+
Error, SendSyncError, HOUR,
4+
};
25
use indexmap::IndexMap;
36
use serenity::{model::prelude::*, prelude::*, utils::CustomMessage};
47
use std::time::Duration;
@@ -28,11 +31,14 @@ pub(crate) fn replay_message(
2831
.content(ev.content.unwrap_or_else(|| String::new()));
2932

3033
let msg = msg.build();
31-
info!(
32-
"sending edited message - {:?} {:?}",
33-
msg.content, msg.author
34-
);
35-
cmds.execute(cx, &msg);
34+
35+
if msg.content.starts_with(PREFIX) {
36+
info!(
37+
"sending edited message - {:?} {:?}",
38+
msg.content, msg.author
39+
);
40+
cmds.execute(cx, &msg);
41+
}
3642
}
3743

3844
Ok(())

src/commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use reqwest::blocking::Client as HttpClient;
88
use serenity::{model::channel::Message, prelude::Context};
99
use std::{collections::HashMap, sync::Arc};
1010

11-
const PREFIX: &'static str = "?";
11+
pub(crate) const PREFIX: &'static str = "?";
1212
pub(crate) type GuardFn = fn(&Args) -> Result<bool, Error>;
1313

1414
struct Command {

0 commit comments

Comments
 (0)