From 5ddc8f17a0958e5bd8bc42475955047ed729dd2b Mon Sep 17 00:00:00 2001 From: Crow Date: Tue, 29 Apr 2025 06:37:48 +0100 Subject: [PATCH] Fix pattern checking on /replace --- public/scripts/slash-commands.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 97120ed92..872a5eb68 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -2079,8 +2079,9 @@ export function initDefaultSlashCommands() { name: 'replace', aliases: ['re'], callback: (async ({ mode = 'literal', pattern, replacer = '' }, text) => { - if (pattern === '') + if (!pattern) { throw new Error('Argument of \'pattern=\' cannot be empty'); + } switch (mode) { case 'literal': return text.replaceAll(pattern, replacer);