quick fix - use _delete for cache delete

This commit is contained in:
DjDeveloperr 2020-12-31 10:19:58 +05:30
parent 2ddb6bf5a5
commit 417854b1bb
5 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ export const channelDelete: GatewayEventHandler = async (
) => {
const channel = await gateway.client.channels.get(d.id)
if (channel !== undefined) {
await gateway.client.channels.delete(d.id)
await gateway.client.channels._delete(d.id)
gateway.client.emit('channelDelete', channel)
}
}

View file

@ -13,7 +13,7 @@ export const guildDelete: GatewayEventHandler = async (
await guild.channels.flush()
await guild.roles.flush()
await guild.presences.flush()
await gateway.client.guilds.delete(d.id)
await gateway.client.guilds._delete(d.id)
gateway.client.emit('guildDelete', guild)
}

View file

@ -13,6 +13,7 @@ export const guildRoleDelete: GatewayEventHandler = async (
const role = await guild.roles.get(d.role_id)
// Shouldn't happen either
if (role === undefined) return
await guild.roles._delete(d.role_id)
gateway.client.emit('guildRoleDelete', role)
}

View file

@ -19,7 +19,6 @@ export const inviteDelete: GatewayEventHandler = async (
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const cachedGuild = await gateway.client.guilds.get(d.guild_id!)
// TODO(DjDeveloperr): Make it support self-bots and make Guild not always defined
if (cachedInvite === undefined) {
const uncachedInvite: PartialInvitePayload = {
guild: (cachedGuild as unknown) as Guild,
@ -28,7 +27,7 @@ export const inviteDelete: GatewayEventHandler = async (
}
return gateway.client.emit('inviteDeleteUncached', uncachedInvite)
} else {
await guild.invites.delete(d.code)
await guild.invites._delete(d.code)
gateway.client.emit('inviteDelete', cachedInvite)
}
}

View file

@ -15,6 +15,6 @@ export const messageDelete: GatewayEventHandler = async (
const message = await channel.messages.get(d.id)
if (message === undefined)
return gateway.client.emit('messageDeleteUncached', d)
await channel.messages.delete(d.id)
await channel.messages._delete(d.id)
gateway.client.emit('messageDelete', message)
}