Translated Subcommand does not register because a error

2024-03-22 19:16:49 - INFO - ApplicationCommandRegistries: Initializing...
2024-03-22 19:16:49 - ERROR - Encountered error while handling the command application command registry for command "language" at path "K:\JS Projects\rubyvoice-bot\dist\commands\settings\language.command.js" ExpectedConstraintError > s.string.regex
2024-03-22 19:16:49 - ERROR - Invalid string format
2024-03-22 19:16:49 - ERROR -
2024-03-22 19:16:49 - ERROR - Expected: expected /^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u.test(expected) to be true
2024-03-22 19:16:49 - ERROR -
2024-03-22 19:16:49 - ERROR - Received:
2024-03-22 19:16:49 - ERROR - | 'Sprache'
2024-03-22 19:16:49 - ERROR -
2024-03-22 19:16:49 - ERROR - at Object.run (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2350:64)
2024-03-22 19:16:49 - ERROR - at K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:939:67
2024-03-22 19:16:49 - ERROR - at Array.reduce (<anonymous>)
2024-03-22 19:16:49 - ERROR - at _StringValidator.parse (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:939:29)
2024-03-22 19:16:49 - ERROR - at validateName (K:\JS Projects\rubyvoice-bot\node_modules\@discordjs\builders\dist\index.js:1578:17)
2024-03-22 19:16:49 - ERROR - at MixedClass.setNameLocalization (K:\JS Projects\rubyvoice-bot\node_modules\@discordjs\builders\dist\index.js:1707:5)
2024-03-22 19:16:49 - ERROR - at MixedClass.setNameLocalizations (K:\JS Projects\rubyvoice-bot\node_modules\@discordjs\builders\dist\index.js:1723:12)
2024-03-22 19:16:49 - ERROR - at applyNameLocalizedBuilder (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\plugin-i18next\dist\cjs\lib\functions.cjs:91:40)
2024-03-22 19:16:49 - ERROR - at applyLocalizedBuilder (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\plugin-i18next\dist\cjs\lib\functions.cjs:101:3)
2024-03-22 19:16:49 - ERROR - at K:\JS Projects\rubyvoice-bot\dist\commands\settings\language.command.js:19:99
2024-03-22 19:16:49 - INFO - ApplicationCommandRegistries: Initializing...
2024-03-22 19:16:49 - ERROR - Encountered error while handling the command application command registry for command "language" at path "K:\JS Projects\rubyvoice-bot\dist\commands\settings\language.command.js" ExpectedConstraintError > s.string.regex
2024-03-22 19:16:49 - ERROR - Invalid string format
2024-03-22 19:16:49 - ERROR -
2024-03-22 19:16:49 - ERROR - Expected: expected /^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u.test(expected) to be true
2024-03-22 19:16:49 - ERROR -
2024-03-22 19:16:49 - ERROR - Received:
2024-03-22 19:16:49 - ERROR - | 'Sprache'
2024-03-22 19:16:49 - ERROR -
2024-03-22 19:16:49 - ERROR - at Object.run (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:2350:64)
2024-03-22 19:16:49 - ERROR - at K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:939:67
2024-03-22 19:16:49 - ERROR - at Array.reduce (<anonymous>)
2024-03-22 19:16:49 - ERROR - at _StringValidator.parse (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\shapeshift\dist\cjs\index.cjs:939:29)
2024-03-22 19:16:49 - ERROR - at validateName (K:\JS Projects\rubyvoice-bot\node_modules\@discordjs\builders\dist\index.js:1578:17)
2024-03-22 19:16:49 - ERROR - at MixedClass.setNameLocalization (K:\JS Projects\rubyvoice-bot\node_modules\@discordjs\builders\dist\index.js:1707:5)
2024-03-22 19:16:49 - ERROR - at MixedClass.setNameLocalizations (K:\JS Projects\rubyvoice-bot\node_modules\@discordjs\builders\dist\index.js:1723:12)
2024-03-22 19:16:49 - ERROR - at applyNameLocalizedBuilder (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\plugin-i18next\dist\cjs\lib\functions.cjs:91:40)
2024-03-22 19:16:49 - ERROR - at applyLocalizedBuilder (K:\JS Projects\rubyvoice-bot\node_modules\@sapphire\plugin-i18next\dist\cjs\lib\functions.cjs:101:3)
2024-03-22 19:16:49 - ERROR - at K:\JS Projects\rubyvoice-bot\dist\commands\settings\language.command.js:19:99
This command does not register. What did i wrong?
Solution:
ahhh, found out! was a space and because not lowercase
Jump to solution
2 Replies
Fabi
FabiOP10mo ago
Related code:
import { Subcommand } from '@sapphire/plugin-subcommands';
import { PermissionFlagsBits, type SlashCommandBuilder } from 'discord.js';
import { applyLocalizedBuilder } from '@sapphire/plugin-i18next';
import { ApplyOptions } from '@sapphire/decorators';

@ApplyOptions<Subcommand.Options>({
runIn: ["GUILD_ANY"],
requiredClientPermissions: [PermissionFlagsBits.EmbedLinks, PermissionFlagsBits.SendMessages],
})
export class SettingsCommands extends Subcommand {
public constructor(context: Subcommand.LoaderContext, options: Subcommand.Options) {
super(context, {
...options,
name: 'language',
subcommands: [
{ name: 'list', chatInputRun: 'chatInputLanguageList' },
{ name: 'set', chatInputRun: 'chatInputLanguageSet' },
{ name: 'current', chatInputRun: 'chatInputLanguageCurrent' }
]
});
}

override registerApplicationCommands(registry: Subcommand.Registry) {
registry.registerChatInputCommand((builder: SlashCommandBuilder) =>
applyLocalizedBuilder(builder, 'language:CommandName', 'language:CommandDescription').setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addSubcommand((command) =>
applyLocalizedBuilder(command, 'language:languageSet', 'language:languageSetDescription')
.addStringOption((option) =>
applyLocalizedBuilder(option, 'language:languageSetOption', 'language:languageSetOptionDescription')
)
)
.addSubcommand((command) =>
applyLocalizedBuilder(command, 'language:languageList', 'language:languageListDescription')
)
.addSubcommand((command) =>
applyLocalizedBuilder(command, 'language:languageCurrent', 'language:languageCurrentDescription')
)
);
}
}
import { Subcommand } from '@sapphire/plugin-subcommands';
import { PermissionFlagsBits, type SlashCommandBuilder } from 'discord.js';
import { applyLocalizedBuilder } from '@sapphire/plugin-i18next';
import { ApplyOptions } from '@sapphire/decorators';

@ApplyOptions<Subcommand.Options>({
runIn: ["GUILD_ANY"],
requiredClientPermissions: [PermissionFlagsBits.EmbedLinks, PermissionFlagsBits.SendMessages],
})
export class SettingsCommands extends Subcommand {
public constructor(context: Subcommand.LoaderContext, options: Subcommand.Options) {
super(context, {
...options,
name: 'language',
subcommands: [
{ name: 'list', chatInputRun: 'chatInputLanguageList' },
{ name: 'set', chatInputRun: 'chatInputLanguageSet' },
{ name: 'current', chatInputRun: 'chatInputLanguageCurrent' }
]
});
}

override registerApplicationCommands(registry: Subcommand.Registry) {
registry.registerChatInputCommand((builder: SlashCommandBuilder) =>
applyLocalizedBuilder(builder, 'language:CommandName', 'language:CommandDescription').setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addSubcommand((command) =>
applyLocalizedBuilder(command, 'language:languageSet', 'language:languageSetDescription')
.addStringOption((option) =>
applyLocalizedBuilder(option, 'language:languageSetOption', 'language:languageSetOptionDescription')
)
)
.addSubcommand((command) =>
applyLocalizedBuilder(command, 'language:languageList', 'language:languageListDescription')
)
.addSubcommand((command) =>
applyLocalizedBuilder(command, 'language:languageCurrent', 'language:languageCurrentDescription')
)
);
}
}
Solution
Fabi
Fabi10mo ago
ahhh, found out! was a space and because not lowercase
Want results from more Discord servers?
Add your server