Skip to content

Commit

Permalink
Add new optional audit log info (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherZane authored May 19, 2024
1 parent 3f6c013 commit 95343cc
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
namespace Disqord.AuditLogs;

public interface IMemberKickedAuditLog : ITargetedAuditLog<IUser>
{ }
{
/// <summary>
/// Gets the type of the integration which kicked the user.
/// </summary>
/// <returns>
/// The type of the integration or <see langword="null"/> if the user was not kicked by an integration.
/// </returns>
string? IntegrationType { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ public interface IMemberRolesUpdatedAuditLog : ITargetedAuditLog<IUser>
/// Gets the names of the roles revoked keyed by their IDs.
/// </summary>
Optional<IReadOnlyDictionary<Snowflake, string>> RevokedRoles { get; }
}

/// <summary>
/// Gets the type of the integration which updated the user's roles.
/// </summary>
/// <returns>
/// The type of the integration or <see langword="null"/> if the roles were not updated by an integration.
/// </returns>
string? IntegrationType { get; }
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Disqord.Models;
using Qommon;

namespace Disqord.AuditLogs;

Expand All @@ -22,6 +23,9 @@ public IUser? Target
}
private IUser? _target;

/// <inheritdoc/>
public string? IntegrationType => Model.Options.Value.IntegrationType.GetValueOrDefault();

public TransientMemberKickedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel? auditLogJsonModel, AuditLogEntryJsonModel model)
: base(client, guildId, auditLogJsonModel, model)
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public IUser? Target
}
private IUser? _target;

/// <inheritdoc/>
public string? IntegrationType => Model.Options.Value.IntegrationType.GetValueOrDefault();

public TransientMemberRolesUpdatedAuditLog(IClient client, Snowflake guildId, AuditLogJsonModel? auditLogJsonModel, AuditLogEntryJsonModel model)
: base(client, guildId, auditLogJsonModel, model)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,11 @@ public class AuditLogEntryOptionsJsonModel : JsonModel
/// </summary>
[JsonProperty("auto_moderation_rule_trigger_type")]
public Optional<AutoModerationRuleTrigger> AutoModerationRuleTriggerType;
}

/// <summary>
/// <see cref="AuditLogActionType.MemberKicked"/>
/// <para />
/// <see cref="AuditLogActionType.MemberRolesUpdated"/>
/// </summary>
public Optional<string> IntegrationType;
}

0 comments on commit 95343cc

Please sign in to comment.