chore: format with csharpier
This commit is contained in:
parent
2f516dcb73
commit
4f54077c68
59 changed files with 2000 additions and 942 deletions
|
|
@ -6,10 +6,21 @@ namespace Catalogger.Backend.Cache.InMemoryCache;
|
|||
|
||||
public class AuditLogCache
|
||||
{
|
||||
private readonly ConcurrentDictionary<(Snowflake GuildId, Snowflake TargetId), ActionData> _kicks = new();
|
||||
private readonly ConcurrentDictionary<(Snowflake GuildId, Snowflake TargetId), ActionData> _bans = new();
|
||||
private readonly ConcurrentDictionary<
|
||||
(Snowflake GuildId, Snowflake TargetId),
|
||||
ActionData
|
||||
> _kicks = new();
|
||||
private readonly ConcurrentDictionary<
|
||||
(Snowflake GuildId, Snowflake TargetId),
|
||||
ActionData
|
||||
> _bans = new();
|
||||
|
||||
public void SetKick(Snowflake guildId, string targetId, Snowflake moderatorId, Optional<string> reason)
|
||||
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");
|
||||
|
|
@ -20,16 +31,21 @@ public class AuditLogCache
|
|||
public bool TryGetKick(Snowflake guildId, Snowflake targetId, out ActionData data) =>
|
||||
_kicks.TryGetValue((guildId, targetId), out data);
|
||||
|
||||
public void SetBan(Snowflake guildId, string targetId, Snowflake moderatorId, Optional<string> reason)
|
||||
public void SetBan(
|
||||
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");
|
||||
|
||||
_bans[(guildId, targetUser.Value)] = new ActionData(moderatorId, reason.OrDefault());
|
||||
}
|
||||
|
||||
|
||||
public bool TryGetBan(Snowflake guildId, Snowflake targetId, out ActionData data) =>
|
||||
_bans.TryGetValue((guildId, targetId), out data);
|
||||
|
||||
public record struct ActionData(Snowflake ModeratorId, string? Reason);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue