Fix pattern checking on /replace

This commit is contained in:
Crow
2025-04-29 06:37:48 +01:00
parent 1c40ea10f4
commit 5ddc8f17a0

View File

@ -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);