diff --git a/server/utils/chats/index.js b/server/utils/chats/index.js index 387b70ce7..067b968ce 100644 --- a/server/utils/chats/index.js +++ b/server/utils/chats/index.js @@ -25,7 +25,10 @@ async function grepCommand(message, user = null) { // Allows multiple commands in one message let updatedMessage = message; for (const preset of userPresets) { - const regex = new RegExp(preset.command, "g"); + const regex = new RegExp( + `(?:\\b\\s|^)(${preset.command})(?:\\b\\s|$)`, + "g" + ); updatedMessage = updatedMessage.replace(regex, preset.prompt); }