mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
fix: Remove trailing invites on channel deletion (#7932)
This commit is contained in:
@@ -61,6 +61,11 @@ class ChannelManager extends CachedManager {
|
|||||||
_remove(id) {
|
_remove(id) {
|
||||||
const channel = this.cache.get(id);
|
const channel = this.cache.get(id);
|
||||||
channel?.guild?.channels.cache.delete(id);
|
channel?.guild?.channels.cache.delete(id);
|
||||||
|
|
||||||
|
for (const [code, invite] of channel?.guild?.invites.cache ?? []) {
|
||||||
|
if (invite.channelId === id) channel.guild.invites.cache.delete(code);
|
||||||
|
}
|
||||||
|
|
||||||
channel?.parent?.threads?.cache.delete(id);
|
channel?.parent?.threads?.cache.delete(id);
|
||||||
this.cache.delete(id);
|
this.cache.delete(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -429,6 +429,7 @@ class GuildChannelManager extends CachedManager {
|
|||||||
const id = this.resolveId(channel);
|
const id = this.resolveId(channel);
|
||||||
if (!id) throw new TypeError('INVALID_TYPE', 'channel', 'GuildChannelResolvable');
|
if (!id) throw new TypeError('INVALID_TYPE', 'channel', 'GuildChannelResolvable');
|
||||||
await this.client.rest.delete(Routes.channel(id), { reason });
|
await this.client.rest.delete(Routes.channel(id), { reason });
|
||||||
|
this.client.actions.ChannelDelete.handle({ id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user