fix: remove role from coll after the event (#304)

* fix: remove role from coll after the event

* fix: check if cachedRole is not nil

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
Ayyan
2020-12-31 11:41:17 +04:00
committed by GitHub
parent d53725d069
commit 02c0466760
+2 -1
View File
@@ -27,8 +27,9 @@ export async function handleInternalGuildRoleDelete(data: DiscordPayload) {
if (!guild) return;
const cachedRole = guild.roles.get(payload.role_id)!;
if (cachedRole) eventHandlers.roleDelete?.(guild, cachedRole);
guild.roles.delete(payload.role_id);
eventHandlers.roleDelete?.(guild, cachedRole);
// For bots without GUILD_MEMBERS member.roles is never updated breaking permissions checking.
cacheHandlers.forEach("members", (member) => {