Skip to content
Snippets Groups Projects
Unverified Commit cf6928fd authored by Mr Simon C's avatar Mr Simon C Committed by GitHub
Browse files

match user prompts exactly not partially (#2245)

parent 9aa77dfb
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,10 @@ async function grepCommand(message, user = null) { ...@@ -25,7 +25,10 @@ async function grepCommand(message, user = null) {
// Allows multiple commands in one message // Allows multiple commands in one message
let updatedMessage = message; let updatedMessage = message;
for (const preset of userPresets) { 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); updatedMessage = updatedMessage.replace(regex, preset.prompt);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment