mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(ContextMenuCommandBuilder): allow emoji in name (#10790)
* fix(ContextMenuCommandBuilder): allow emoji in name * test: add emoji from 16.0 https://emojipedia.org/fingerprint * chore: non rule-breaking regex * feat: use simplified regex Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com> * style: prettier --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d1f56ffb2a
commit
28a945069f
@@ -27,6 +27,11 @@ describe('Context Menu Commands', () => {
|
||||
|
||||
// Translation: thx (according to GTranslate)
|
||||
expect(() => getBuilder().setName('どうも')).not.toThrowError();
|
||||
|
||||
expect(() => getBuilder().setName('🎉').toJSON()).not.toThrowError();
|
||||
expect(() => getBuilder().setName('').toJSON()).not.toThrowError();
|
||||
expect(() => getBuilder().setName('🎉 abc').toJSON()).not.toThrowError();
|
||||
expect(() => getBuilder().setName(' abc').toJSON()).not.toThrowError();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ const namePredicate = z
|
||||
.string()
|
||||
.min(1)
|
||||
.max(32)
|
||||
// eslint-disable-next-line prefer-named-capture-group
|
||||
.regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]+ *)+$/u);
|
||||
.regex(/^(?:(?: *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}\p{Extended_Pictographic}\p{Emoji_Component}]) *)+$/u);
|
||||
|
||||
const contextsPredicate = z.array(z.nativeEnum(InteractionContextType));
|
||||
const integrationTypesPredicate = z.array(z.nativeEnum(ApplicationIntegrationType));
|
||||
|
||||
Reference in New Issue
Block a user