From dc975b49111a0c972b29b1a25af1e4c95c21fd46 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:45:17 +0200 Subject: [PATCH] feat: ChannelDeleteChangeSet --- .../ChangeSet/ChannelDeleteChangeSet.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs index f76c54061..26c1ed199 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs @@ -1,7 +1,27 @@ -namespace DisCatSharp.Entities; +using System.Linq; + +using DisCatSharp.Enums; + +namespace DisCatSharp.Entities; /// /// Represents a change set for a channel deletion. /// -public class ChannelDeleteChangeSet : DiscordAuditLogEntry -{ } +public sealed class ChannelDeleteChangeSet : DiscordAuditLogEntry +{ + internal ChannelDeleteChangeSet() + { + this.ValidFor = AuditLogActionType.ChannelDelete; + } + + public string Name => (string)this.Changes.FirstOrDefault(x => x.Key == "name")?.OldValue; + public string? Topic => (string?)this.Changes.FirstOrDefault(x => x.Key == "topic")?.OldValue; + public ChannelType Type => (ChannelType)this.Changes.FirstOrDefault(x => x.Key == "type")?.OldValue; + public DiscordOverwrite[] PermissionOverwrites => (DiscordOverwrite[])this.Changes.FirstOrDefault(x => x.Key == "permission_overwrites")?.OldValue; + public bool IsNfsw => (bool)this.Changes.FirstOrDefault(x => x.Key == "nsfw")?.OldValue; + public int PerUserRateLimit => (int)this.Changes.FirstOrDefault(x => x.Key == "rate_limit_per_user")?.OldValue; + public ThreadAutoArchiveDuration? DefaultAutoArchiveDuration => (ThreadAutoArchiveDuration?)this.Changes.FirstOrDefault(x => x.Key == "default_auto_archive_duration")?.NewValue; + public DiscordEmoji? IconEmoji => (DiscordEmoji?)this.Changes.FirstOrDefault(x => x.Key == "icon_emoji")?.OldValue; + public ForumPostTag? AvailableTags => (ForumPostTag?)this.Changes.FirstOrDefault(x => x.Key == "available_tags")?.OldValue; + public ChannelFlags Flags => (ChannelFlags)this.Changes.FirstOrDefault(x => x.Key == "flags")?.OldValue; +}