diff --git a/src/localization/en_gb/settings/en_gb_moderation.lang b/src/localization/en_gb/settings/en_gb_moderation.lang index 837edcf..6e5ba52 100644 --- a/src/localization/en_gb/settings/en_gb_moderation.lang +++ b/src/localization/en_gb/settings/en_gb_moderation.lang @@ -318,6 +318,9 @@ Aborted. [SETTING_MUTE_ROLE_MANAGED] Cannot use a manged role for mute. +[SETTING_MUTE_MISSING_CHANNEL_PERMS] +Could not create channel overrides in **{channel}** + //////////////////////////////////////////////////////////////// // Wordfilter diff --git a/src/structure/components/settings/moderation/Mute.js b/src/structure/components/settings/moderation/Mute.js index 1f0edae..67137a7 100644 --- a/src/structure/components/settings/moderation/Mute.js +++ b/src/structure/components/settings/moderation/Mute.js @@ -130,8 +130,10 @@ class MuteSetting extends Setting { const textIssues = issues.filter((i) => i.type === 'GUILD_TEXT'); const voiceIssues = issues.filter((i) => i.type === 'GUILD_VOICE'); + const permissionIssues = issues.filter((i) => i.type === 'permission'); if (textIssues.length) embed.fields.push(addField(textIssues, 'text')); if (voiceIssues.length) embed.fields.push(addField(voiceIssues, 'voice')); + if (permissionIssues.length) embed.fields.push({ name: 'Missing `MANAGE_ROLES`', value: permissionIssues.map((i) => invoker.guild.format('SETTING_MUTE_MISSING_CHANNEL_PERMS', i)).join('\n') }); response.embeds = [embed]; updated.push('role'); @@ -248,6 +250,11 @@ class MuteSetting extends Setting { for (const channel of channels.values()) { + if (!channel.permissionsFor(guild.me).has('MANAGE_ROLES')) { + issues.push({ type: 'permission', channel: channel.name }); + continue; + } + const configuration = channel.type === 'GUILD_TEXT' ? { permissions: { SEND_MESSAGES: false, ADD_REACTIONS: false }, bitwise: 0x800n } : { permissions: { CONNECT: false, SEND_MESSAGES: false, ADD_REACTIONS: false }, bitwise: 0x100000n };