Skip to content

Commit

Permalink
Implement support for audit log reason when modifying the MFA level.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihlus committed Aug 19, 2022
1 parent 8ef9710 commit 46b3ef0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -594,12 +594,14 @@ Task<Result<IRole>> ModifyGuildRoleAsync
/// </summary>
/// <param name="guildID">The ID of the guild to modify.</param>
/// <param name="level">The new MFA level.</param>
/// <param name="reason">The reason to mark the action in the audit log with.</param>
/// <param name="ct">The cancellation token for this operation.</param>
/// <returns>A modification result which may or may not have succeeded.</returns>
Task<Result<MultiFactorAuthenticationLevel>> ModifyGuildMFALevelAsync
(
Snowflake guildID,
MultiFactorAuthenticationLevel level,
Optional<string> reason = default,
CancellationToken ct = default
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ public Task<Result<MultiFactorAuthenticationLevel>> ModifyGuildMFALevelAsync
(
Snowflake guildID,
MultiFactorAuthenticationLevel level,
Optional<string> reason = default,
CancellationToken ct = default
)
{
return _actual.ModifyGuildMFALevelAsync(guildID, level, ct);
return _actual.ModifyGuildMFALevelAsync(guildID, level, reason, ct);
}

/// <inheritdoc />
Expand Down
2 changes: 2 additions & 0 deletions Backend/Remora.Discord.Rest/API/Guilds/DiscordRestGuildAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -886,13 +886,15 @@ public Task<Result<MultiFactorAuthenticationLevel>> ModifyGuildMFALevelAsync
(
Snowflake guildID,
MultiFactorAuthenticationLevel level,
Optional<string> reason = default,
CancellationToken ct = default
)
{
return this.RestHttpClient.PostAsync<MultiFactorAuthenticationLevel>
(
$"guilds/{guildID}/mfa",
b => b
.AddAuditLogReason(reason)
.WithJson
(
json =>
Expand Down

0 comments on commit 46b3ef0

Please sign in to comment.