Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
fix: delete related cache on deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Mar 3, 2024
1 parent 2d26e7b commit 9f08420
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { channels } from "@nezuchan/kanao-schema";
import { channels, channelsOverwrite } from "@nezuchan/kanao-schema";
import type { GatewayChannelDeleteDispatch } from "discord-api-types/v10";
import { GatewayDispatchEvents } from "discord-api-types/v10";
import { eq } from "drizzle-orm";
Expand All @@ -17,6 +17,7 @@ export class ChannelPintsUpdateListener extends Listener {

public async run(payload: { data: GatewayChannelDeleteDispatch; shardId: number; }): Promise<void> {
await this.container.client.drizzle.delete(channels).where(eq(channels.id, payload.data.d.id));
await this.container.client.drizzle.delete(channelsOverwrite).where(eq(channelsOverwrite.channelId, payload.data.d.id));

await DispatchListener.dispatch(payload);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { members } from "@nezuchan/kanao-schema";
import { memberRoles, members } from "@nezuchan/kanao-schema";
import type { GatewayGuildMemberRemoveDispatch } from "discord-api-types/v10";
import { GatewayDispatchEvents } from "discord-api-types/v10";
import { eq } from "drizzle-orm";
Expand All @@ -15,6 +15,7 @@ export class GuildMemberRemoveListener extends Listener {

public async run(payload: { data: GatewayGuildMemberRemoveDispatch; shardId: number; }): Promise<void> {
await this.container.client.drizzle.delete(members).where(eq(members.id, payload.data.d.user.id));
await this.container.client.drizzle.delete(memberRoles).where(eq(memberRoles.memberId, payload.data.d.user.id));

await DispatchListener.dispatch(payload);
}
Expand Down

0 comments on commit 9f08420

Please sign in to comment.