fix embed queue

This commit is contained in:
sam 2024-08-13 16:48:54 +02:00
parent ded4f4db26
commit 8d4a7b1729
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
13 changed files with 188 additions and 32 deletions

View file

@ -10,7 +10,9 @@ public class ChannelCacheService
private readonly ConcurrentDictionary<Snowflake, IChannel> _channels = new();
private readonly ConcurrentDictionary<Snowflake, HashSet<Snowflake>> _guildChannels = new();
public void AddChannel(IChannel channel, Snowflake? guildId = null)
public int Size => _channels.Count;
public void Set(IChannel channel, Snowflake? guildId = null)
{
_channels[channel.ID] = channel;
if (guildId == null)
@ -29,9 +31,9 @@ public class ChannelCacheService
});
}
public bool GetChannel(Snowflake id, [NotNullWhen(true)] out IChannel? channel) => _channels.TryGetValue(id, out channel);
public bool TryGet(Snowflake id, [NotNullWhen(true)] out IChannel? channel) => _channels.TryGetValue(id, out channel);
public void RemoveChannel(Snowflake? guildId, Snowflake id, out IChannel? channel)
public void Remove(Snowflake? guildId, Snowflake id, out IChannel? channel)
{
_channels.Remove(id, out channel);
if (guildId == null) return;