Skip to content

Commit 8e770ed

Browse files
committed
Properly remove prefix from message
Closes #205
1 parent c67d709 commit 8e770ed

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/chat/chat_handler.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,18 @@ pub struct DispatchCommand {
513513

514514
impl DispatchCommand {
515515
pub async fn run_command(&self) {
516-
let mut params = self.chat_message.message.split_whitespace();
516+
let mut params = {
517+
// Unwrap is safe here because the command was already parsed
518+
let state = self.user.state.read().await;
519+
let chat = state.config.chat.as_ref().unwrap();
520+
let prefix = &chat.prefix;
521+
522+
self.chat_message
523+
.message
524+
.strip_prefix(prefix)
525+
.unwrap()
526+
.split_whitespace()
527+
};
517528
params.next();
518529

519530
match &self.command {

0 commit comments

Comments
 (0)