mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
slight fix for deleted roles without members inten
This commit is contained in:
@@ -30,6 +30,11 @@ export async function handleInternalGuildRoleDelete(data: DiscordPayload) {
|
||||
const cachedRole = guild.roles.get(payload.role_id)!;
|
||||
guild.roles.delete(payload.role_id);
|
||||
eventHandlers.roleDelete?.(guild, cachedRole);
|
||||
|
||||
// For bots without GUILD_MEMBERS member.roles is never updated breaking permissions checking.
|
||||
guild.members.forEach(member => {
|
||||
member.roles = member.roles.filter(id => id !== payload.role_id);
|
||||
});
|
||||
}
|
||||
|
||||
export async function handleInternalGuildRoleUpdate(data: DiscordPayload) {
|
||||
|
||||
@@ -58,6 +58,8 @@ export async function botHasPermission(
|
||||
|
||||
const permissionBits = member.roles
|
||||
.map((id) => guild.roles.get(id)!)
|
||||
// Remove any edge case undefined
|
||||
.filter((r) => r)
|
||||
.reduce((bits, data) => {
|
||||
bits |= BigInt(data.permissions);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user