From ea082e5f51074a722e3a6d0238956aa69ecb8925 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 7 Jul 2022 21:12:35 +0300 Subject: [PATCH] small fixes --- .../commands/administration/Permissions.js | 23 ++++++++++++------- .../components/settings/logging/Voice.js | 4 ++-- src/utilities/SettingsMigrator.js | 3 +-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/structure/components/commands/administration/Permissions.js b/src/structure/components/commands/administration/Permissions.js index b43f64d..26dec9b 100644 --- a/src/structure/components/commands/administration/Permissions.js +++ b/src/structure/components/commands/administration/Permissions.js @@ -237,15 +237,22 @@ class PermissionsCommand extends SlashCommand { const target = role?.value || member?.value; const targetPerms = permissions[target.id]; - fields.push({ - name: interaction.format('COMMAND_PERMISSIONS_GLOBAL_PERMS'), - value: `\`${targetPerms.global.join('`, `')}\`` - }); - const channels = channel ? [channel.value] : await guild.resolveChannels(Object.keys(targetPerms.channels)); - for (const ch of channels) { + if(targetPerms) { fields.push({ - name: `#${ch.name}`, - value: `\`${targetPerms.channels[ch.id].join('`, `')}\`` + name: interaction.format('COMMAND_PERMISSIONS_GLOBAL_PERMS'), + value: `\`${targetPerms.global.join('`, `')}\`` + }); + const channels = channel ? [channel.value] : await guild.resolveChannels(Object.keys(targetPerms.channels)); + for (const ch of channels) { + fields.push({ + name: `#${ch.name}`, + value: `\`${targetPerms.channels[ch.id].join('`, `')}\`` + }); + } + } else { + fields.push({ + name: target.name || target.user.tag, + value: guild.format('COMMAND_PERMISSIONS_NO_PERMS') }); } diff --git a/src/structure/components/settings/logging/Voice.js b/src/structure/components/settings/logging/Voice.js index 972a42c..ebbf632 100644 --- a/src/structure/components/settings/logging/Voice.js +++ b/src/structure/components/settings/logging/Voice.js @@ -33,7 +33,7 @@ class Voice extends Setting { if (opts.enabled) setting.enabled = opts.enabled.value; if (opts.channel) setting.channel = opts.channel.value.id; - + return { index: 'SETTING_SUCCESS_ALT' }; } @@ -48,7 +48,7 @@ class Voice extends Setting { }, { name: 'GENERAL_CHANNEL', - value: `<#${setting.channel}>`, + value: setting.channel ? `<#${setting.channel}>` : '**N/A**', inline: true } ]; diff --git a/src/utilities/SettingsMigrator.js b/src/utilities/SettingsMigrator.js index a2de1c6..8a400d5 100644 --- a/src/utilities/SettingsMigrator.js +++ b/src/utilities/SettingsMigrator.js @@ -68,7 +68,7 @@ class SettingsMigrator { // const { _version } = settings; // if (!_version) return Promise.reject(new Error('Unable to determine configuration version')); - const translated = this[version](settings); + const translated = this[version](settings.settings || settings); let webhook = null, permissions = null; @@ -207,7 +207,6 @@ class SettingsMigrator { } '2'(result) { - if (result.settings) result = result.settings; const { moderation, modlogs, muterole, mutetype, automod, wordFilter, ignore, invitefilter, chatlogs, activity, selfrole, killitwithfire, memberlogs, staffRole, staffRule, modpoints, userlogs, grantable, privatelog, linkfilter, autorole, welcomer, prefix, protection } = result;