Skip to content

Commit 9c8a224

Browse files
authored
🐛 Use new regex for command naming
1 parent 936e6db commit 9c8a224

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Diff for: src/components/CreateSlashCommand.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default {
101101
if (commandNameMinLength) return 'Name can not be shorter than 3 characters.';
102102
const commandNameMaxLength = this.name.length > 32;
103103
if (commandNameMaxLength) return 'Name can not be longer than 32 characters.';
104-
const invalidCharacters = !(/^[0-9a-zA-Z_]+$/.test(this.name));
104+
const invalidCharacters = !(/^[\w_-]{1,32}$/u.test(this.name));
105105
if (invalidCharacters) return 'Name contains invalid characters.';
106106
return null;
107107
},

Diff for: src/components/CreateSubCommand.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default {
9797
if (nameMinLength) return 'The sub command name can not be shorter than 3 characters!';
9898
const nameMaxLength = this.name.length > 32;
9999
if (nameMaxLength) return 'The sub command name can not be longer than 32 characters!';
100-
const invalidCharacters = !(/^[0-9a-zA-Z_]+$/.test(this.name));
100+
const invalidCharacters = !(/^[\w_-]{1,32}$/u.test(this.name));
101101
if (invalidCharacters) return 'Name contains invalid characters.';
102102
return null;
103103
},

Diff for: src/components/CreateSubGroup.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default {
9797
if (nameMinLength) return 'The group name can not be shorter than 3 characters!';
9898
const nameMaxLength = this.name.length > 32;
9999
if (nameMaxLength) return 'The group name can not be longer than 32 characters!';
100-
const invalidCharacters = !(/^[0-9a-zA-Z_]+$/.test(this.name));
100+
const invalidCharacters = !(/^[\w_-]{1,32}$/u.test(this.name));
101101
if (invalidCharacters) return 'Name contains invalid characters.';
102102
return null;
103103
},

Diff for: src/components/SlashCommandOptionForm.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export default {
203203
if (nameMinLength) return 'The option name can not be shorter than 3 characters!';
204204
const nameMaxLength = this.name.length > 32;
205205
if (nameMaxLength) return 'The option name can not be longer than 32 characters!';
206-
const invalidCharacters = !(/^[0-9a-zA-Z_]+$/.test(this.name));
206+
const invalidCharacters = !(/^[\w_-]{1,32}$/u.test(this.name));
207207
if (invalidCharacters) return 'Name contains invalid characters.';
208208
return null;
209209
},
@@ -274,4 +274,4 @@ export default {
274274
}
275275
}
276276
};
277-
</script>
277+
</script>

0 commit comments

Comments
 (0)