From 95343cc0c4560018b284ff15bc93254e98cc1d5c Mon Sep 17 00:00:00 2001 From: Zane Pereira Date: Sun, 19 May 2024 22:37:42 +0530 Subject: [PATCH] Add new optional audit log info (#118) --- .../Core/AuditLogs/Member/IMemberKickedAuditLog.cs | 10 +++++++++- .../AuditLogs/Member/IMemberRolesUpdatedAuditLog.cs | 10 +++++++++- .../AuditLogs/Member/TransientMemberKickedAuditLog.cs | 4 ++++ .../Member/TransientMemberRolesUpdatedAuditLog.cs | 3 +++ .../Models/AuditLog/AuditLogEntryOptionsJsonModel.cs | 9 ++++++++- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberKickedAuditLog.cs b/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberKickedAuditLog.cs index 4ca78db39..cd4e54cf8 100644 --- a/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberKickedAuditLog.cs +++ b/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberKickedAuditLog.cs @@ -1,4 +1,12 @@ namespace Disqord.AuditLogs; public interface IMemberKickedAuditLog : ITargetedAuditLog -{ } \ No newline at end of file +{ + /// + /// Gets the type of the integration which kicked the user. + /// + /// + /// The type of the integration or if the user was not kicked by an integration. + /// + string? IntegrationType { get; } +} diff --git a/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberRolesUpdatedAuditLog.cs b/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberRolesUpdatedAuditLog.cs index 2ace3db48..bb4634f7e 100644 --- a/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberRolesUpdatedAuditLog.cs +++ b/src/Disqord.Core/Entities/Core/AuditLogs/Member/IMemberRolesUpdatedAuditLog.cs @@ -14,4 +14,12 @@ public interface IMemberRolesUpdatedAuditLog : ITargetedAuditLog /// Gets the names of the roles revoked keyed by their IDs. /// Optional> RevokedRoles { get; } -} \ No newline at end of file + + /// + /// Gets the type of the integration which updated the user's roles. + /// + /// + /// The type of the integration or if the roles were not updated by an integration. + /// + string? IntegrationType { get; } +} diff --git a/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberKickedAuditLog.cs b/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberKickedAuditLog.cs index e84cdabba..03388037d 100644 --- a/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberKickedAuditLog.cs +++ b/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberKickedAuditLog.cs @@ -1,5 +1,6 @@ using System; using Disqord.Models; +using Qommon; namespace Disqord.AuditLogs; @@ -22,6 +23,9 @@ public IUser? Target } private IUser? _target; + /// + public string? IntegrationType => Model.Options.Value.IntegrationType.GetValueOrDefault(); + public TransientMemberKickedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel? auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { } diff --git a/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberRolesUpdatedAuditLog.cs b/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberRolesUpdatedAuditLog.cs index 349234efa..eff946220 100644 --- a/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberRolesUpdatedAuditLog.cs +++ b/src/Disqord.Core/Entities/Transient/AuditLogs/Member/TransientMemberRolesUpdatedAuditLog.cs @@ -32,6 +32,9 @@ public IUser? Target } private IUser? _target; + /// + public string? IntegrationType => Model.Options.Value.IntegrationType.GetValueOrDefault(); + public TransientMemberRolesUpdatedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel? auditLogJsonModel, AuditLogEntryJsonModel model) : base(client, guildId, auditLogJsonModel, model) { diff --git a/src/Disqord.Core/Models/AuditLog/AuditLogEntryOptionsJsonModel.cs b/src/Disqord.Core/Models/AuditLog/AuditLogEntryOptionsJsonModel.cs index ccb31d897..77ebc59c0 100644 --- a/src/Disqord.Core/Models/AuditLog/AuditLogEntryOptionsJsonModel.cs +++ b/src/Disqord.Core/Models/AuditLog/AuditLogEntryOptionsJsonModel.cs @@ -100,4 +100,11 @@ public class AuditLogEntryOptionsJsonModel : JsonModel /// [JsonProperty("auto_moderation_rule_trigger_type")] public Optional AutoModerationRuleTriggerType; -} \ No newline at end of file + + /// + /// + /// + /// + /// + public Optional IntegrationType; +}