21 lines
No EOL
810 B
C#
21 lines
No EOL
810 B
C#
using System.Collections.Concurrent;
|
|
using Remora.Discord.API;
|
|
using Remora.Rest.Core;
|
|
|
|
namespace Catalogger.Backend.Cache.InMemoryCache;
|
|
|
|
public class AuditLogCache
|
|
{
|
|
private readonly ConcurrentDictionary<(Snowflake, Snowflake), ModactionData> _kicks = new();
|
|
private readonly ConcurrentDictionary<(Snowflake, Snowflake), ModactionData> _bans = new();
|
|
|
|
public void SetKick(Snowflake guildId, string targetId, Snowflake moderatorId, Optional<string> reason)
|
|
{
|
|
if (!DiscordSnowflake.TryParse(targetId, out var targetUser))
|
|
throw new CataloggerError("Target ID was not a valid snowflake");
|
|
|
|
_kicks[(guildId, targetUser.Value)] = new ModactionData(moderatorId, reason.OrDefault());
|
|
}
|
|
|
|
public record struct ModactionData(Snowflake ModeratorId, string? Reason);
|
|
} |