convert bot permission from botid to botroleid
This commit is contained in:
parent
58eef38295
commit
e0a4745ace
|
@ -225,13 +225,20 @@ The Discord Slash Command system will ensure you provide all the required detail
|
||||||
mgrRoleErrorOut = true;
|
mgrRoleErrorOut = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
const x = await bot.helpers.getRoles(interaction.guildId);
|
const guildRoles = await bot.helpers.getRoles(interaction.guildId);
|
||||||
x.forEach(role => log(LT.INFO, `${utils.jsonStringifyBig(role)}`))
|
let botRoleId = 0n
|
||||||
|
guildRoles.some(role => {
|
||||||
|
if (role.botId === botId) {
|
||||||
|
botRoleId = role.id;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
// Set permissions for self, skip if we already failed to set roles
|
// Set permissions for self, skip if we already failed to set roles
|
||||||
!mgrRoleErrorOut && await bot.helpers.editChannelPermissionOverrides(interaction.channelId, {
|
!mgrRoleErrorOut && await bot.helpers.editChannelPermissionOverrides(interaction.channelId, {
|
||||||
id: botId,
|
id: botRoleId,
|
||||||
type: OverwriteTypes.Member,
|
type: OverwriteTypes.Role,
|
||||||
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'EMBED_LINKS'],
|
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'EMBED_LINKS'],
|
||||||
}).catch((e: Error) => {
|
}).catch((e: Error) => {
|
||||||
utils.commonLoggers.channelUpdateError('setup.ts', 'self-allow', e);
|
utils.commonLoggers.channelUpdateError('setup.ts', 'self-allow', e);
|
||||||
|
|
Loading…
Reference in New Issue