wip: guild member remove
This commit is contained in:
parent
db01f879bd
commit
516ce3a6e9
6 changed files with 95 additions and 1 deletions
21
Catalogger.Backend/Cache/InMemoryCache/AuditLogCache.cs
Normal file
21
Catalogger.Backend/Cache/InMemoryCache/AuditLogCache.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue