fix: creating multi-category panels in non-english locales

The Discord client replaces `,` with `.` in some locales (why!!?). This removes the requirement for category IDs to be separated by commas.
This commit is contained in:
Isaac 2021-10-07 11:49:07 +01:00
parent 4146665e13
commit c607771c9e
No known key found for this signature in database
GPG Key ID: 87B9B6BD04EB7534

View File

@ -67,9 +67,7 @@ module.exports = class PanelCommand extends Command {
const default_i18n = this.client.i18n.getLocale(this.client.config.defaults.locale); // command properties could be in a different locale const default_i18n = this.client.i18n.getLocale(this.client.config.defaults.locale); // command properties could be in a different locale
const i18n = this.client.i18n.getLocale(settings.locale); const i18n = this.client.i18n.getLocale(settings.locale);
const categories = interaction.options.getString(default_i18n('commands.panel.options.categories.name')) const categories = interaction.options.getString(default_i18n('commands.panel.options.categories.name')).match(/\d{17,19}/g) ?? [];
.replace(/\s/g, '')
.split(',');
const description = interaction.options.getString(default_i18n('commands.panel.options.description.name'))?.replace(/\\n/g, '\n'); const description = interaction.options.getString(default_i18n('commands.panel.options.description.name'))?.replace(/\\n/g, '\n');
const image = interaction.options.getString(default_i18n('commands.panel.options.image.name')); const image = interaction.options.getString(default_i18n('commands.panel.options.image.name'));
const just_type = interaction.options.getBoolean(default_i18n('commands.panel.options.just_type.name')); const just_type = interaction.options.getBoolean(default_i18n('commands.panel.options.just_type.name'));