feat(api): also clear cache when leaving a guild
This commit is contained in:
parent
5c57b75335
commit
439051999f
10 changed files with 53 additions and 0 deletions
|
|
@ -81,4 +81,17 @@ public class ChannelCache
|
|||
.Select(id => _channels.GetValueOrDefault(id))
|
||||
.Where(c => c != null)
|
||||
.Select(c => c!);
|
||||
|
||||
public void RemoveGuild(Snowflake guildId)
|
||||
{
|
||||
if (!_guildChannels.TryGetValue(guildId, out var channelIds))
|
||||
return;
|
||||
|
||||
foreach (var id in channelIds)
|
||||
{
|
||||
_channels.Remove(id, out _);
|
||||
}
|
||||
|
||||
_guildChannels.Remove(guildId, out _);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue