From b2fecac2f48b300604cf92b72a014a6ef4dea230 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Tue, 17 Oct 2023 15:42:38 +0200 Subject: [PATCH] aaaaaa --- ...icationCommandPermissionUpdateChangeSet.cs | 2 +- .../AuditLog/ChangeSet/AuditLogChangeSet.cs | 29 --------- .../AutoModerationBlockMessageChangeSet.cs | 2 +- .../AutoModerationFlagToChannelChangeSet.cs | 2 +- .../AutoModerationRuleCreateChangeSet.cs | 2 +- .../AutoModerationRuleDeleteChangeSet.cs | 2 +- .../AutoModerationRuleUpdateChangeSet.cs | 2 +- ...ationUserCommunicationDisabledChangeSet.cs | 2 +- .../AuditLog/ChangeSet/BotAddChangeSet.cs | 2 +- .../ChangeSet/ChannelCreateChangeSet.cs | 2 +- .../ChangeSet/ChannelDeleteChangeSet.cs | 2 +- .../ChannelOverwriteCreateChangeSet.cs | 11 ++-- .../ChannelOverwriteDeleteChangeSet.cs | 10 ++-- .../ChannelOverwriteUpdateChangeSet.cs | 10 ++-- .../ChangeSet/ChannelUpdateChangeSet.cs | 2 +- ...atorMonetizationRequestCreatedChangeSet.cs | 2 +- ...eatorMonetizationTermsAcceptedChangeSet.cs | 2 +- .../ChangeSet/EmojiCreateChangeSet.cs | 2 +- .../ChangeSet/EmojiDeleteChangeSet.cs | 2 +- .../ChangeSet/EmojiUpdateChangeSet.cs | 2 +- .../GuildScheduledEventCreateChangeSet.cs | 2 +- .../GuildScheduledEventDeleteChangeSet.cs | 2 +- .../GuildScheduledEventUpdateChangeSet.cs | 2 +- .../ChangeSet/GuildUpdateChangeSet.cs | 39 ++++++------ .../ChangeSet/IntegrationCreateChangeSet.cs | 2 +- .../ChangeSet/IntegrationDeleteChangeSet.cs | 2 +- .../ChangeSet/IntegrationUpdateChangeSet.cs | 2 +- .../ChangeSet/InviteCreateChangeSet.cs | 2 +- .../ChangeSet/InviteDeleteChangeSet.cs | 2 +- .../ChangeSet/InviteUpdateChangeSet.cs | 2 +- .../ChangeSet/MemberBanAddChangeSet.cs | 2 +- .../ChangeSet/MemberBanRemoveChangeSet.cs | 2 +- .../ChangeSet/MemberDisconnectChangeSet.cs | 2 +- .../AuditLog/ChangeSet/MemberKickChangeSet.cs | 2 +- .../AuditLog/ChangeSet/MemberMoveChangeSet.cs | 2 +- .../ChangeSet/MemberPruneChangeSet.cs | 2 +- .../ChangeSet/MemberRoleUpdateChangeSet.cs | 2 +- .../ChangeSet/MemberUpdateChangeSet.cs | 2 +- .../ChangeSet/MessageBulkDeleteChangeSet.cs | 2 +- .../ChangeSet/MessageDeleteChangeSet.cs | 2 +- .../AuditLog/ChangeSet/MessagePinChangeSet.cs | 2 +- .../ChangeSet/MessageUnpinChangeSet.cs | 2 +- .../OnboardingQuestionCreateChangeSet.cs | 2 +- .../OnboardingQuestionUpdateChangeSet.cs | 2 +- .../ChangeSet/OnboardingUpdateChangeSet.cs | 2 +- .../AuditLog/ChangeSet/RoleCreateChangeSet.cs | 2 +- .../AuditLog/ChangeSet/RoleDeleteChangeSet.cs | 2 +- .../AuditLog/ChangeSet/RoleUpdateChangeSet.cs | 2 +- .../ChangeSet/ServerGuideCreateChangeSet.cs | 2 +- .../ChangeSet/ServerGuideUpdateChangeSet.cs | 2 +- .../ChangeSet/StageInstanceCreateChangeSet.cs | 2 +- .../ChangeSet/StageInstanceDeleteChangeSet.cs | 2 +- .../ChangeSet/StageInstanceUpdateChangeSet.cs | 2 +- .../ChangeSet/StickerCreateChangeSet.cs | 2 +- .../ChangeSet/StickerDeleteChangeSet.cs | 2 +- .../ChangeSet/StickerUpdateChangeSet.cs | 2 +- .../ChangeSet/ThreadCreateChangeSet.cs | 2 +- .../ChangeSet/ThreadDeleteChangeSet.cs | 2 +- .../ChangeSet/ThreadUpdateChangeSet.cs | 2 +- .../VoiceChannelStatusUpdateChangeSet.cs | 2 +- .../ChangeSet/WebhookCreateChangeSet.cs | 2 +- .../ChangeSet/WebhookDeleteChangeSet.cs | 2 +- .../ChangeSet/WebhookUpdateChangeSet.cs | 2 +- .../Guild/AuditLog/DiscordAuditEntryInfo.cs | 2 +- .../Guild/AuditLog/DiscordAuditLogEntry.cs | 59 +++++++++++++++++-- 65 files changed, 150 insertions(+), 126 deletions(-) delete mode 100644 DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AuditLogChangeSet.cs diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ApplicationCommandPermissionUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ApplicationCommandPermissionUpdateChangeSet.cs index 343655f3b..c7adea23a 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ApplicationCommandPermissionUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ApplicationCommandPermissionUpdateChangeSet.cs @@ -3,5 +3,5 @@ namespace DisCatSharp.Entities; /// /// Represents a change set for updating permissions for an application command. /// -public class ApplicationCommandPermissionUpdateChangeSet : AuditLogChangeSet +public class ApplicationCommandPermissionUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AuditLogChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AuditLogChangeSet.cs deleted file mode 100644 index 32a243c9a..000000000 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AuditLogChangeSet.cs +++ /dev/null @@ -1,29 +0,0 @@ -using DisCatSharp.Enums; - -namespace DisCatSharp.Entities; - -/// -/// Represents a dynamic change set. -/// -public class AuditLogChangeSet : DiscordAuditLogEntry -{ - /// - /// Gets the change description. - /// - public virtual string? ChangeDescription { get; internal set; } = null; - - /// - /// Gets the valid action type for this change set. - /// - public AuditLogActionType ValidFor { get; internal set; } - - /// - /// Gets whether this change set is valid. - /// - public bool IsValid - => this.ActionType == this.ValidFor; - - /// - public override string ToString() - => this.ChangeDescription ?? $"{this.UserId} executed {this.GetType().Name}"; -} diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationBlockMessageChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationBlockMessageChangeSet.cs index a1e169149..ece0794ea 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationBlockMessageChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationBlockMessageChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for a message being blocked by Auto Moderation. /// -public class AutoModerationBlockMessageChangeSet : AuditLogChangeSet +public class AutoModerationBlockMessageChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationFlagToChannelChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationFlagToChannelChangeSet.cs index 8f4c0d95d..80512b90d 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationFlagToChannelChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationFlagToChannelChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for a message being flagged by Auto Moderation. /// -public class AutoModerationFlagToChannelChangeSet : AuditLogChangeSet +public class AutoModerationFlagToChannelChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleCreateChangeSet.cs index daaaca380..55c45ff31 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating an Auto Moderation rule. /// -public class AutoModerationRuleCreateChangeSet : AuditLogChangeSet +public class AutoModerationRuleCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleDeleteChangeSet.cs index 8a4f69159..d51f2fd65 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleDeleteChangeSet.cs @@ -3,5 +3,5 @@ namespace DisCatSharp.Entities; /// /// Represents a change set for deleting an Auto Moderation rule. /// -public class AutoModerationRuleDeleteChangeSet : AuditLogChangeSet +public class AutoModerationRuleDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleUpdateChangeSet.cs index 0bfd70dcc..b9a41bd75 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationRuleUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating an Auto Moderation rule. /// -public class AutoModerationRuleUpdateChangeSet : AuditLogChangeSet +public class AutoModerationRuleUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationUserCommunicationDisabledChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationUserCommunicationDisabledChangeSet.cs index ccf479706..cd8e3e12e 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationUserCommunicationDisabledChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/AutoModerationUserCommunicationDisabledChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for a member being timed out by Auto Moderation. /// -public class AutoModerationUserCommunicationDisabledChangeSet : AuditLogChangeSet +public class AutoModerationUserCommunicationDisabledChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/BotAddChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/BotAddChangeSet.cs index dc7c90574..7c1f24063 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/BotAddChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/BotAddChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for adding a bot user to the server. /// -public class BotAddChangeSet : AuditLogChangeSet +public class BotAddChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelCreateChangeSet.cs index bbccf8db2..96d7b4a46 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelCreateChangeSet.cs @@ -3,5 +3,5 @@ namespace DisCatSharp.Entities; /// /// Represents a change set for a new channel creation. /// -public class ChannelCreateChangeSet : AuditLogChangeSet +public class ChannelCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs index 2c8ba7229..f76c54061 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for a channel deletion. /// -public class ChannelDeleteChangeSet : AuditLogChangeSet +public class ChannelDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteCreateChangeSet.cs index 82d2ba595..f5431e42e 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteCreateChangeSet.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; using DisCatSharp.Enums; @@ -8,10 +7,12 @@ namespace DisCatSharp.Entities; /// /// Represents a change set for adding a permission overwrite to a channel. /// -public class ChannelOverwriteCreateChangeSet : AuditLogChangeSet +public class ChannelOverwriteCreateChangeSet : DiscordAuditLogEntry { - /// - public new AuditLogActionType ValidFor = AuditLogActionType.ChannelOverwriteCreate; + public ChannelOverwriteCreateChangeSet() + { + this.ValidFor = AuditLogActionType.ChannelOverwriteCreate; + } public bool AllowChanged => this.AllowBefore is not null || this.AllowAfter is not null; public Permissions? AllowBefore => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "allow")?.OldValue; @@ -21,7 +22,7 @@ public class ChannelOverwriteCreateChangeSet : AuditLogChangeSet public Permissions? DenyBefore => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "deny")?.OldValue; public Permissions? DenyAfter => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "deny")?.NewValue; - public override string ChangeDescription + internal override string ChangeDescription { get { diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteDeleteChangeSet.cs index c3492ef09..8967036a7 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteDeleteChangeSet.cs @@ -7,10 +7,12 @@ namespace DisCatSharp.Entities; /// /// Represents a change set for deleting a permission overwrite from a channel. /// -public class ChannelOverwriteDeleteChangeSet : AuditLogChangeSet +public class ChannelOverwriteDeleteChangeSet : DiscordAuditLogEntry { - /// - public new AuditLogActionType ValidFor = AuditLogActionType.ChannelOverwriteDelete; + public ChannelOverwriteDeleteChangeSet() + { + this.ValidFor = AuditLogActionType.ChannelOverwriteDelete; + } public bool AllowChanged => this.AllowBefore is not null || this.AllowAfter is not null; public Permissions? AllowBefore => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "allow")?.OldValue; @@ -20,7 +22,7 @@ public class ChannelOverwriteDeleteChangeSet : AuditLogChangeSet public Permissions? DenyBefore => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "deny")?.OldValue; public Permissions? DenyAfter => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "deny")?.NewValue; - public override string ChangeDescription + internal override string ChangeDescription { get { diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteUpdateChangeSet.cs index 439f23911..658eebcba 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelOverwriteUpdateChangeSet.cs @@ -7,10 +7,12 @@ namespace DisCatSharp.Entities; /// /// Represents a change set for updating a permission overwrite for a channel. /// -public class ChannelOverwriteUpdateChangeSet : AuditLogChangeSet +public class ChannelOverwriteUpdateChangeSet : DiscordAuditLogEntry { - /// - public new AuditLogActionType ValidFor = AuditLogActionType.ChannelOverwriteUpdate; + public ChannelOverwriteUpdateChangeSet() + { + this.ValidFor = AuditLogActionType.ChannelOverwriteUpdate; + } public bool AllowChanged => this.AllowBefore is not null || this.AllowAfter is not null; public Permissions? AllowBefore => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "allow")?.OldValue; @@ -20,7 +22,7 @@ public class ChannelOverwriteUpdateChangeSet : AuditLogChangeSet public Permissions? DenyBefore => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "deny")?.OldValue; public Permissions? DenyAfter => (Permissions?)this.Changes.FirstOrDefault(x => x.Key == "deny")?.NewValue; - public override string ChangeDescription + internal override string ChangeDescription { get { diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelUpdateChangeSet.cs index c939a3d6d..0304b7829 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ChannelUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating channel settings. /// -public class ChannelUpdateChangeSet : AuditLogChangeSet +public class ChannelUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationRequestCreatedChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationRequestCreatedChangeSet.cs index c41baa4de..c7f0cb67c 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationRequestCreatedChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationRequestCreatedChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for the creation of a creator monetization request. /// -public class CreatorMonetizationRequestCreatedChangeSet : AuditLogChangeSet +public class CreatorMonetizationRequestCreatedChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationTermsAcceptedChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationTermsAcceptedChangeSet.cs index 74a540e2d..e7692c6e9 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationTermsAcceptedChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationTermsAcceptedChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for the acceptance of creator monetization terms. /// -public class CreatorMonetizationTermsAcceptedChangeSet : AuditLogChangeSet +public class CreatorMonetizationTermsAcceptedChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiCreateChangeSet.cs index 851dd1199..31336fb63 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating an emoji. /// -public class EmojiCreateChangeSet : AuditLogChangeSet +public class EmojiCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiDeleteChangeSet.cs index 3f5eeb1a6..b6dbc0240 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting an emoji. /// -public class EmojiDeleteChangeSet : AuditLogChangeSet +public class EmojiDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiUpdateChangeSet.cs index e3319af11..ce37fe407 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating the name of an emoji. /// -public class EmojiUpdateChangeSet : AuditLogChangeSet +public class EmojiUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventCreateChangeSet.cs index a21a3995b..d811481ac 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a guild scheduled event. /// -public class GuildScheduledEventCreateChangeSet : AuditLogChangeSet +public class GuildScheduledEventCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventDeleteChangeSet.cs index 68f7f2d9b..cd6cd6642 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for cancelling a guild scheduled event. /// -public class GuildScheduledEventDeleteChangeSet : AuditLogChangeSet +public class GuildScheduledEventDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventUpdateChangeSet.cs index b84f57636..45e4bf4ae 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildScheduledEventUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating a guild scheduled event. /// -public class GuildScheduledEventUpdateChangeSet : AuditLogChangeSet +public class GuildScheduledEventUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildUpdateChangeSet.cs index 751cee354..341308ab1 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/GuildUpdateChangeSet.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; @@ -9,10 +8,12 @@ namespace DisCatSharp.Entities; /// /// Represents a change set for a server settings update. /// -public class GuildUpdateChangeSet : AuditLogChangeSet +public class GuildUpdateChangeSet : DiscordAuditLogEntry { - /// - public new AuditLogActionType ValidFor = AuditLogActionType.GuildUpdate; + public GuildUpdateChangeSet() + { + this.ValidFor = AuditLogActionType.GuildUpdate; + } public bool NameChanged => this.NameBefore is not null || this.NameAfter is not null; public string? NameBefore => (string?)this.Changes.FirstOrDefault(x => x.Key == "name")?.OldValue; @@ -31,12 +32,12 @@ public class GuildUpdateChangeSet : AuditLogChangeSet public string? DiscoverySplashAfter => (string?)this.Changes.FirstOrDefault(x => x.Key == "discovery_splash")?.NewValue; public bool OwnerIdChanged => this.OwnerIdBefore is not null || this.OwnerIdAfter is not null; - public ulong? OwnerIdBefore => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "owner_id")?.OldValue; - public ulong? OwnerIdAfter => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "owner_id")?.NewValue; + public ulong? OwnerIdBefore => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "owner_id")?.OldValue); + public ulong? OwnerIdAfter => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "owner_id")?.NewValue); public bool AfkChannelIdChanged => this.AfkChannelIdBefore is not null || this.AfkChannelIdAfter is not null; - public ulong? AfkChannelIdBefore => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "afk_channel_id")?.OldValue; - public ulong? AfkChannelIdAfter => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "afk_channel_id")?.NewValue; + public ulong? AfkChannelIdBefore =>ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "afk_channel_id")?.OldValue); + public ulong? AfkChannelIdAfter => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "afk_channel_id")?.NewValue); public bool AfkTimeoutChanged => this.AfkTimeoutBefore is not null || this.AfkTimeoutAfter is not null; public int? AfkTimeoutBefore => (int?)this.Changes.FirstOrDefault(x => x.Key == "afk_timeout")?.OldValue; @@ -47,8 +48,8 @@ public class GuildUpdateChangeSet : AuditLogChangeSet public bool? WidgetEnabledAfter => (bool?)this.Changes.FirstOrDefault(x => x.Key == "widget_enabled")?.NewValue; public bool WidgetChannelIdChanged => this.WidgetChannelIdBefore is not null || this.WidgetChannelIdAfter is not null; - public ulong? WidgetChannelIdBefore => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "widget_channel_id")?.OldValue; - public ulong? WidgetChannelIdAfter => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "widget_channel_id")?.NewValue; + public ulong? WidgetChannelIdBefore => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "widget_channel_id")?.OldValue); + public ulong? WidgetChannelIdAfter => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "widget_channel_id")?.NewValue); public bool VerificationLevelChanged => this.VerificationLevelBefore is not null || this.VerificationLevelAfter is not null; public VerificationLevel? VerificationLevelBefore => (VerificationLevel?)this.Changes.FirstOrDefault(x => x.Key == "verification_level")?.OldValue; @@ -71,16 +72,16 @@ public class GuildUpdateChangeSet : AuditLogChangeSet public MfaLevel? MfaLevelAfter => (MfaLevel?)this.Changes.FirstOrDefault(x => x.Key == "mfa_level")?.NewValue; public bool SystemChannelIdChanged => this.SystemChannelIdBefore is not null || this.SystemChannelIdAfter is not null; - public ulong? SystemChannelIdBefore => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "system_channel_id")?.OldValue; - public ulong? SystemChannelIdAfter => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "system_channel_id")?.NewValue; + public ulong? SystemChannelIdBefore => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "system_channel_id")?.OldValue); + public ulong? SystemChannelIdAfter => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "system_channel_id")?.NewValue); public bool SystemChannelFlagsChanged => this.SystemChannelFlagsBefore is not null || this.SystemChannelFlagsAfter is not null; public SystemChannelFlags? SystemChannelFlagsBefore => (SystemChannelFlags?)this.Changes.FirstOrDefault(x => x.Key == "system_channel_flags")?.OldValue; public SystemChannelFlags? SystemChannelFlagsAfter => (SystemChannelFlags?)this.Changes.FirstOrDefault(x => x.Key == "system_channel_flags")?.NewValue; public bool RulesChannelIdChanged => this.RulesChannelIdBefore is not null || this.RulesChannelIdAfter is not null; - public ulong? RulesChannelIdBefore => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "rules_channel_id")?.OldValue; - public ulong? RulesChannelIdAfter => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "rules_channel_id")?.NewValue; + public ulong? RulesChannelIdBefore => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "rules_channel_id")?.OldValue); + public ulong? RulesChannelIdAfter => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "rules_channel_id")?.NewValue); public bool VanityUrlCodeChanged => this.VanityUrlCodeBefore is not null || this.VanityUrlCodeAfter is not null; public string? VanityUrlCodeBefore => (string?)this.Changes.FirstOrDefault(x => x.Key == "vanity_url_code")?.OldValue; @@ -99,8 +100,8 @@ public class GuildUpdateChangeSet : AuditLogChangeSet public string? PreferredLocaleAfter => (string?)this.Changes.FirstOrDefault(x => x.Key == "preferred_locale")?.NewValue; public bool PublicUpdatesChannelIdChanged => this.PublicUpdatesChannelIdBefore is not null || this.PublicUpdatesChannelIdAfter is not null; - public ulong? PublicUpdatesChannelIdBefore => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "public_updates_channel_id")?.OldValue; - public ulong? PublicUpdatesChannelIdAfter => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "public_updates_channel_id")?.NewValue; + public ulong? PublicUpdatesChannelIdBefore => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "public_updates_channel_id")?.OldValue); + public ulong? PublicUpdatesChannelIdAfter => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "public_updates_channel_id")?.NewValue); public bool NsfwLevelChanged => this.NsfwLevelBefore is not null || this.NsfwLevelAfter is not null; public NsfwLevel? NsfwLevelBefore => (NsfwLevel?)this.Changes.FirstOrDefault(x => x.Key == "nsfw_level")?.OldValue; @@ -111,10 +112,10 @@ public class GuildUpdateChangeSet : AuditLogChangeSet public bool? PremiumProgressBarEnabledAfter => (bool?)this.Changes.FirstOrDefault(x => x.Key == "premium_progress_bar_enabled")?.NewValue; public bool SafetyAlertsChannelIdChanged => this.SafetyAlertsChannelIdBefore is not null || this.SafetyAlertsChannelIdAfter is not null; - public ulong? SafetyAlertsChannelIdBefore => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "safety_alerts_channel_id")?.OldValue; - public ulong? SafetyAlertsChannelIdAfter => (ulong?)this.Changes.FirstOrDefault(x => x.Key == "safety_alerts_channel_id")?.NewValue; + public ulong? SafetyAlertsChannelIdBefore => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "safety_alerts_channel_id")?.OldValue); + public ulong? SafetyAlertsChannelIdAfter => ConvertToUlong(this.Changes.FirstOrDefault(x => x.Key == "safety_alerts_channel_id")?.NewValue); - public override string ChangeDescription + internal override string ChangeDescription { get { diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationCreateChangeSet.cs index 30799ff7c..4cd1a9d75 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for adding an app to the server. /// -public class IntegrationCreateChangeSet : AuditLogChangeSet +public class IntegrationCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationDeleteChangeSet.cs index 16266d5e6..c2a104720 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for removing an app from the server. /// -public class IntegrationDeleteChangeSet : AuditLogChangeSet +public class IntegrationDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationUpdateChangeSet.cs index 37712f808..29d33f1f0 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/IntegrationUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating an app, such as its scopes. /// -public class IntegrationUpdateChangeSet : AuditLogChangeSet +public class IntegrationUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteCreateChangeSet.cs index e040fb203..2fc31c234 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a server invite. /// -public class InviteCreateChangeSet : AuditLogChangeSet +public class InviteCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteDeleteChangeSet.cs index 72daa10d5..bedebe2f0 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting a server invite. /// -public class InviteDeleteChangeSet : AuditLogChangeSet +public class InviteDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteUpdateChangeSet.cs index a073877f4..bba96f9b4 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/InviteUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating a server invite. /// -public class InviteUpdateChangeSet : AuditLogChangeSet +public class InviteUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanAddChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanAddChangeSet.cs index 9057cd1a8..2d2193ece 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanAddChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanAddChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for banning a member from the server. /// -public class MemberBanAddChangeSet : AuditLogChangeSet +public class MemberBanAddChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanRemoveChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanRemoveChangeSet.cs index 40d4022d4..6bd7dd1ae 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanRemoveChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberBanRemoveChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for lifting a server ban for a member. /// -public class MemberBanRemoveChangeSet : AuditLogChangeSet +public class MemberBanRemoveChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberDisconnectChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberDisconnectChangeSet.cs index 0596c87cf..304ffdc61 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberDisconnectChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberDisconnectChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for disconnecting a member from a voice channel. /// -public class MemberDisconnectChangeSet : AuditLogChangeSet +public class MemberDisconnectChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberKickChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberKickChangeSet.cs index 59ead476a..a797d7eea 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberKickChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberKickChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for removing a member from the server. /// -public class MemberKickChangeSet : AuditLogChangeSet +public class MemberKickChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberMoveChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberMoveChangeSet.cs index 9840f3f6c..4b0a3614b 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberMoveChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberMoveChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for moving a member to a different voice channel. /// -public class MemberMoveChangeSet : AuditLogChangeSet +public class MemberMoveChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberPruneChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberPruneChangeSet.cs index ef6a296a6..32daff8c4 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberPruneChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberPruneChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for pruning members from the server. /// -public class MemberPruneChangeSet : AuditLogChangeSet +public class MemberPruneChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberRoleUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberRoleUpdateChangeSet.cs index f27741946..26d39e70c 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberRoleUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberRoleUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for adding or removing a role from a member. /// -public class MemberRoleUpdateChangeSet : AuditLogChangeSet +public class MemberRoleUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberUpdateChangeSet.cs index 1e82a8978..65c14d780 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MemberUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating a member in the server. /// -public class MemberUpdateChangeSet : AuditLogChangeSet +public class MemberUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageBulkDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageBulkDeleteChangeSet.cs index 832d02a05..01d80cbf0 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageBulkDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageBulkDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting multiple messages. /// -public class MessageBulkDeleteChangeSet : AuditLogChangeSet +public class MessageBulkDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageDeleteChangeSet.cs index 8aa38573d..5a051f12f 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting a single message. /// -public class MessageDeleteChangeSet : AuditLogChangeSet +public class MessageDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessagePinChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessagePinChangeSet.cs index fe0c76513..bab1687e4 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessagePinChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessagePinChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for pinning a message to a channel. /// -public class MessagePinChangeSet : AuditLogChangeSet +public class MessagePinChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageUnpinChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageUnpinChangeSet.cs index 5efdbb3db..07f7c9ab4 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageUnpinChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/MessageUnpinChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for unpinning a message from a channel. /// -public class MessageUnpinChangeSet : AuditLogChangeSet +public class MessageUnpinChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionCreateChangeSet.cs index b1384cbe9..3410429f1 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating an onboarding question. /// -public class OnboardingQuestionCreateChangeSet : AuditLogChangeSet +public class OnboardingQuestionCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionUpdateChangeSet.cs index 855ea62a7..ad5325952 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingQuestionUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating an onboarding question. /// -public class OnboardingQuestionUpdateChangeSet : AuditLogChangeSet +public class OnboardingQuestionUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingUpdateChangeSet.cs index 0c2fefa6f..f8d0f165c 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/OnboardingUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating onboarding settings. /// -public class OnboardingUpdateChangeSet : AuditLogChangeSet +public class OnboardingUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleCreateChangeSet.cs index 9cecc4c18..5a58f0c91 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a role. /// -public class RoleCreateChangeSet : AuditLogChangeSet +public class RoleCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleDeleteChangeSet.cs index 646b5a1aa..39b01aa68 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting a role. /// -public class RoleDeleteChangeSet : AuditLogChangeSet +public class RoleDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleUpdateChangeSet.cs index ea059f88e..1801fb4bf 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/RoleUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for editing a role. /// -public class RoleUpdateChangeSet : AuditLogChangeSet +public class RoleUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideCreateChangeSet.cs index 9c0c045fe..0d48bcfce 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a server guide. /// -public class ServerGuideCreateChangeSet : AuditLogChangeSet +public class ServerGuideCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideUpdateChangeSet.cs index 82d028806..0e0226dd6 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ServerGuideUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating a server guide. /// -public class ServerGuideUpdateChangeSet : AuditLogChangeSet +public class ServerGuideUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceCreateChangeSet.cs index 75d0f869a..566b1fd1a 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a stage instance, making a stage channel live. /// -public class StageInstanceCreateChangeSet : AuditLogChangeSet +public class StageInstanceCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceDeleteChangeSet.cs index 6d8ea7c88..eeacfbbb7 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting a stage instance, ending a live stage channel. /// -public class StageInstanceDeleteChangeSet : AuditLogChangeSet +public class StageInstanceDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceUpdateChangeSet.cs index fe431b98a..ef67718ed 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StageInstanceUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating stage instance details. /// -public class StageInstanceUpdateChangeSet : AuditLogChangeSet +public class StageInstanceUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerCreateChangeSet.cs index 3504d181d..538d84e7a 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a sticker. /// -public class StickerCreateChangeSet : AuditLogChangeSet +public class StickerCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerDeleteChangeSet.cs index 8aea30b5e..ca0dc9daf 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting a sticker. /// -public class StickerDeleteChangeSet : AuditLogChangeSet +public class StickerDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerUpdateChangeSet.cs index 6cce5a28b..4c3a2d07d 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/StickerUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating sticker details. /// -public class StickerUpdateChangeSet : AuditLogChangeSet +public class StickerUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadCreateChangeSet.cs index 3171fb711..8bb6e8221 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a thread in a channel. /// -public class ThreadCreateChangeSet : AuditLogChangeSet +public class ThreadCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadDeleteChangeSet.cs index 9c9c45fd1..277ef8502 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting a thread. /// -public class ThreadDeleteChangeSet : AuditLogChangeSet +public class ThreadDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadUpdateChangeSet.cs index bd3221778..f9d6758b2 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/ThreadUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating a thread. /// -public class ThreadUpdateChangeSet : AuditLogChangeSet +public class ThreadUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/VoiceChannelStatusUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/VoiceChannelStatusUpdateChangeSet.cs index cca242302..00976b061 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/VoiceChannelStatusUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/VoiceChannelStatusUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating voice channel status. /// -public class VoiceChannelStatusUpdateChangeSet : AuditLogChangeSet +public class VoiceChannelStatusUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookCreateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookCreateChangeSet.cs index 97c2ffcad..d01d8395b 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookCreateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookCreateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for creating a webhook. /// -public class WebhookCreateChangeSet : AuditLogChangeSet +public class WebhookCreateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookDeleteChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookDeleteChangeSet.cs index e4ead295c..0ae35421f 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookDeleteChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookDeleteChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for deleting a webhook. /// -public class WebhookDeleteChangeSet : AuditLogChangeSet +public class WebhookDeleteChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookUpdateChangeSet.cs b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookUpdateChangeSet.cs index c125cef50..935da1cf6 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookUpdateChangeSet.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/ChangeSet/WebhookUpdateChangeSet.cs @@ -3,5 +3,5 @@ /// /// Represents a change set for updating a webhook or its properties. /// -public class WebhookUpdateChangeSet : AuditLogChangeSet +public class WebhookUpdateChangeSet : DiscordAuditLogEntry { } diff --git a/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditEntryInfo.cs b/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditEntryInfo.cs index 2a95438dc..6a1c37576 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditEntryInfo.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditEntryInfo.cs @@ -56,7 +56,7 @@ public sealed class DiscordAuditEntryInfo /// Event Types: , , "/> /// [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] - public SnowflakeObject? OverwrittenEntityId { get; internal set; } = null; + public ulong? OverwrittenEntityId { get; internal set; } = null; /// /// Gets or sets the number of members removed by the prune. diff --git a/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditLogEntry.cs b/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditLogEntry.cs index 2cbb8a6d9..90bff6110 100644 --- a/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditLogEntry.cs +++ b/DisCatSharp/Entities/Guild/AuditLog/DiscordAuditLogEntry.cs @@ -16,7 +16,7 @@ public class DiscordAuditLogEntry : SnowflakeObject /// Gets the ID of the affected entity (webhook, user, role, etc.). /// [JsonProperty("target_id", NullValueHandling = NullValueHandling.Ignore)] - public SnowflakeObject? TargetId { get; internal set; } + public ulong? TargetId { get; internal set; } /// /// Gets the list of changes made to the target_id. @@ -49,14 +49,61 @@ public class DiscordAuditLogEntry : SnowflakeObject public string? Reason { get; internal set; } /// - /// Gets this as an easy to-use with the given type. + /// Gets the change description. + /// + [JsonIgnore] + internal virtual string? ChangeDescription { get; set; } = null; + + /// + /// Gets the valid action type for this change set. + /// + [JsonIgnore] + internal AuditLogActionType ValidFor { get; init; } + + /// + public override string ToString() + => this.ChangeDescription ?? $"{this.UserId} executed {this.ActionType}"; + + /// + /// Gets this as an easy to-use change set with the given type. /// /// The type to convert to. Use the type based on the . /// The easy to-use audit log entry. - /// Thrown when the is not compatible with the targets type. + /// Thrown when the is not compatible with the targets type. public T? As() - where T : AuditLogChangeSet - => this is T { IsValid: true } toConvert - ? toConvert + where T : DiscordAuditLogEntry, new() + { + if (this is T t) + return t.ValidFor == this.ActionType + ? t + : throw new InvalidCastException($"Cannot convert {this.GetType().Name} with action type {this.ActionType} to {typeof(T).Name}."); + + var target = new T + { + TargetId = this.TargetId, + Changes = this.Changes, + UserId = this.UserId, + ActionType = this.ActionType, + Options = this.Options, + Id = this.Id + }; + + return target.ValidFor == this.ActionType + ? target : throw new InvalidCastException($"Cannot convert {this.GetType().Name} with action type {this.ActionType} to {typeof(T).Name}."); + } + + /// + /// Converts an object to ulong?. + /// + /// The object to convert. + internal static ulong? ConvertToUlong(object? obj) + { + var str = obj?.ToString(); + return str == null + ? null + : ulong.TryParse(str, out var val) + ? val + : null; + } }