[Feature] Audit log integration type (#2814)
* why do I do this instead of preparing for an exam * oh yeah nullable ofc * oh yeah
This commit is contained in:
@@ -39,4 +39,7 @@ internal class AuditLogOptions
|
||||
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; }
|
||||
|
||||
[JsonProperty("integration_type")]
|
||||
public string IntegrationType { get; set; }
|
||||
}
|
||||
|
||||
@@ -9,15 +9,16 @@ namespace Discord.Rest;
|
||||
/// </summary>
|
||||
public class KickAuditLogData : IAuditLogData
|
||||
{
|
||||
private KickAuditLogData(RestUser user)
|
||||
private KickAuditLogData(RestUser user, string integrationType)
|
||||
{
|
||||
Target = user;
|
||||
IntegrationType = integrationType;
|
||||
}
|
||||
|
||||
internal static KickAuditLogData Create(BaseDiscordClient discord, EntryModel entry, Model log = null)
|
||||
{
|
||||
var userInfo = log.Users.FirstOrDefault(x => x.Id == entry.TargetId);
|
||||
return new KickAuditLogData((userInfo != null) ? RestUser.Create(discord, userInfo) : null);
|
||||
return new KickAuditLogData((userInfo != null) ? RestUser.Create(discord, userInfo) : null, entry.Options?.IntegrationType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,4 +31,9 @@ public class KickAuditLogData : IAuditLogData
|
||||
/// A user object representing the kicked user.
|
||||
/// </returns>
|
||||
public IUser Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of integration which performed the action. <see langword="null"/> if the action was performed by a user.
|
||||
/// </summary>
|
||||
public string IntegrationType { get; }
|
||||
}
|
||||
|
||||
@@ -10,10 +10,11 @@ namespace Discord.Rest;
|
||||
/// </summary>
|
||||
public class MemberRoleAuditLogData : IAuditLogData
|
||||
{
|
||||
private MemberRoleAuditLogData(IReadOnlyCollection<MemberRoleEditInfo> roles, IUser target)
|
||||
private MemberRoleAuditLogData(IReadOnlyCollection<MemberRoleEditInfo> roles, IUser target, string integrationType)
|
||||
{
|
||||
Roles = roles;
|
||||
Target = target;
|
||||
IntegrationType = integrationType;
|
||||
}
|
||||
|
||||
internal static MemberRoleAuditLogData Create(BaseDiscordClient discord, EntryModel entry, Model log = null)
|
||||
@@ -28,7 +29,7 @@ public class MemberRoleAuditLogData : IAuditLogData
|
||||
var userInfo = log.Users.FirstOrDefault(x => x.Id == entry.TargetId);
|
||||
RestUser user = (userInfo != null) ? RestUser.Create(discord, userInfo) : null;
|
||||
|
||||
return new MemberRoleAuditLogData(roleInfos.ToReadOnlyCollection(), user);
|
||||
return new MemberRoleAuditLogData(roleInfos.ToReadOnlyCollection(), user, entry.Options?.IntegrationType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,4 +48,9 @@ public class MemberRoleAuditLogData : IAuditLogData
|
||||
/// A user object representing the user that the role changes were performed on.
|
||||
/// </returns>
|
||||
public IUser Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of integration which performed the action. <see langword="null"/> if the action was performed by a user.
|
||||
/// </summary>
|
||||
public string IntegrationType { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user