From c607771c9ef299a7de91cf76d54590deab4ad40e Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 7 Oct 2021 11:49:07 +0100 Subject: [PATCH] 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. --- src/commands/panel.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/commands/panel.js b/src/commands/panel.js index 69f7601..03ef9ae 100644 --- a/src/commands/panel.js +++ b/src/commands/panel.js @@ -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 i18n = this.client.i18n.getLocale(settings.locale); - const categories = interaction.options.getString(default_i18n('commands.panel.options.categories.name')) - .replace(/\s/g, '') - .split(','); + const categories = interaction.options.getString(default_i18n('commands.panel.options.categories.name')).match(/\d{17,19}/g) ?? []; 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 just_type = interaction.options.getBoolean(default_i18n('commands.panel.options.just_type.name'));