channel perms check when creating mute
This commit is contained in:
parent
afdf63e8a6
commit
7028179152
@ -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
|
||||
|
@ -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 };
|
||||
|
Loading…
Reference in New Issue
Block a user