-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
10 deletions.
There are no files selected for viewing
15 changes: 13 additions & 2 deletions
15
DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationRequestCreatedChangeSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
namespace DisCatSharp.Entities; | ||
using DisCatSharp.Enums; | ||
|
||
namespace DisCatSharp.Entities; | ||
|
||
/// <summary> | ||
/// Represents a change set for the creation of a creator monetization request. | ||
/// </summary> | ||
public class CreatorMonetizationRequestCreatedChangeSet : DiscordAuditLogEntry | ||
{ } | ||
{ | ||
public CreatorMonetizationRequestCreatedChangeSet() | ||
{ | ||
this.ValidFor = AuditLogActionType.CreatorMonetizationRequestCreated; | ||
} | ||
|
||
/// <inheritdoc /> | ||
internal override string? ChangeDescription | ||
=> $"{this.UserId} created Creator Monetization Request"; | ||
} |
15 changes: 13 additions & 2 deletions
15
DisCatSharp/Entities/Guild/AuditLog/ChangeSet/CreatorMonetizationTermsAcceptedChangeSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
namespace DisCatSharp.Entities; | ||
using DisCatSharp.Enums; | ||
|
||
namespace DisCatSharp.Entities; | ||
|
||
/// <summary> | ||
/// Represents a change set for the acceptance of creator monetization terms. | ||
/// </summary> | ||
public class CreatorMonetizationTermsAcceptedChangeSet : DiscordAuditLogEntry | ||
{ } | ||
{ | ||
public CreatorMonetizationTermsAcceptedChangeSet() | ||
{ | ||
this.ValidFor = AuditLogActionType.CreatorMonetizationTermsAccepted; | ||
} | ||
|
||
/// <inheritdoc /> | ||
internal override string? ChangeDescription | ||
=> $"{this.UserId} accepted Creator Monetization Terms"; | ||
} |
33 changes: 31 additions & 2 deletions
33
DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiCreateChangeSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
namespace DisCatSharp.Entities; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
using DisCatSharp.Enums; | ||
|
||
namespace DisCatSharp.Entities; | ||
|
||
/// <summary> | ||
/// Represents a change set for creating an emoji. | ||
/// </summary> | ||
public class EmojiCreateChangeSet : DiscordAuditLogEntry | ||
{ } | ||
{ | ||
public EmojiCreateChangeSet() | ||
{ | ||
this.ValidFor = AuditLogActionType.EmojiCreate; | ||
} | ||
|
||
public string? EmojiName => (string?)this.Changes.FirstOrDefault(x => x.Key == "name")?.NewValue; | ||
public IReadOnlyList<ulong>? RolesAllowed => ((IReadOnlyList<string>?)this.Changes.FirstOrDefault(x => x.Key == "roles")?.NewValue)?.Select(x => ConvertToUlong(x)!.Value).ToList(); | ||
public bool EmojiNameChanged => this.EmojiName is not null; | ||
public bool RolesAllowedChanged => this.RolesAllowed is not null; | ||
|
||
/// <inheritdoc /> | ||
internal override string ChangeDescription | ||
{ | ||
get | ||
{ | ||
var description = $"{this.UserId} created a new emoji with the following details:\n"; | ||
if (this.EmojiNameChanged) | ||
description += $"- Emoji Name: {this.EmojiName}\n"; | ||
if (this.RolesAllowedChanged) | ||
description += $"- Roles Allowed: {string.Join(", ", this.RolesAllowed)}\n"; | ||
return description; | ||
} | ||
} | ||
} |
33 changes: 31 additions & 2 deletions
33
DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiDeleteChangeSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
namespace DisCatSharp.Entities; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
using DisCatSharp.Enums; | ||
|
||
namespace DisCatSharp.Entities; | ||
|
||
/// <summary> | ||
/// Represents a change set for deleting an emoji. | ||
/// </summary> | ||
public class EmojiDeleteChangeSet : DiscordAuditLogEntry | ||
{ } | ||
{ | ||
public EmojiDeleteChangeSet() | ||
{ | ||
this.ValidFor = AuditLogActionType.EmojiDelete; | ||
} | ||
|
||
public string? EmojiName => (string?)this.Changes.FirstOrDefault(x => x.Key == "name")?.OldValue; | ||
public IReadOnlyList<ulong>? RolesAllowed => ((IReadOnlyList<string>?)this.Changes.FirstOrDefault(x => x.Key == "roles")?.OldValue)?.Select(x => ConvertToUlong(x)!.Value).ToList(); | ||
public bool EmojiNameChanged => this.EmojiName is not null; | ||
public bool RolesAllowedChanged => this.RolesAllowed is not null; | ||
|
||
/// <inheritdoc /> | ||
internal override string ChangeDescription | ||
{ | ||
get | ||
{ | ||
var description = $"{this.UserId} deleted emoji {this.TargetId}:\n"; | ||
if (this.EmojiNameChanged) | ||
description += $"- Name: {this.EmojiName}\n"; | ||
if (this.RolesAllowedChanged) | ||
description += $"- Roles Allowed: {string.Join(", ", this.RolesAllowed)}\n"; | ||
return description; | ||
} | ||
} | ||
} |
43 changes: 41 additions & 2 deletions
43
DisCatSharp/Entities/Guild/AuditLog/ChangeSet/EmojiUpdateChangeSet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,46 @@ | ||
namespace DisCatSharp.Entities; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
using DisCatSharp.Enums; | ||
|
||
namespace DisCatSharp.Entities; | ||
|
||
/// <summary> | ||
/// Represents a change set for updating the name of an emoji. | ||
/// </summary> | ||
public class EmojiUpdateChangeSet : DiscordAuditLogEntry | ||
{ } | ||
{ | ||
public EmojiUpdateChangeSet() | ||
{ | ||
this.ValidFor = AuditLogActionType.EmojiUpdate; | ||
} | ||
|
||
public string? EmojiNameBefore => (string?)this.Changes.FirstOrDefault(x => x.Key == "name")?.OldValue; | ||
public string? EmojiNameAfter => (string?)this.Changes.FirstOrDefault(x => x.Key == "name")?.NewValue; | ||
public IReadOnlyList<ulong>? RolesAllowedBefore => ((IReadOnlyList<string>?)this.Changes.FirstOrDefault(x => x.Key == "roles")?.OldValue)?.Select(x => ConvertToUlong(x)!.Value).ToList(); | ||
public IReadOnlyList<ulong>? RolesAllowedAfter => ((IReadOnlyList<string>?)this.Changes.FirstOrDefault(x => x.Key == "roles")?.NewValue)?.Select(x => ConvertToUlong(x)!.Value).ToList(); | ||
public bool EmojiNameChanged => this.EmojiNameBefore is not null || this.EmojiNameAfter is not null; | ||
public bool RolesAllowedChanged => this.RolesAllowedBefore is not null || this.RolesAllowedAfter is not null; | ||
|
||
/// <inheritdoc /> | ||
internal override string ChangeDescription | ||
{ | ||
get | ||
{ | ||
var description = $"{this.UserId} updated emoji {this.TargetId}:\n"; | ||
if (this.EmojiNameChanged) | ||
{ | ||
description += this.EmojiNameBefore is not null ? $"- Emoji Name Before: {this.EmojiNameBefore}\n" : "- Emoji Name Before: Not set\n"; | ||
description += this.EmojiNameAfter is not null ? $"- Emoji Name After: {this.EmojiNameAfter}\n" : "- Emoji Name After: Not set\n"; | ||
} | ||
|
||
if (this.RolesAllowedChanged) | ||
{ | ||
description += this.RolesAllowedBefore is not null ? $"- Roles Before: {string.Join(", ", this.RolesAllowedBefore)}\n" : "- Roles Before: Not set\n"; | ||
description += this.RolesAllowedAfter is not null ? $"- Roles After: {string.Join(", ", this.RolesAllowedAfter)}\n" : "- Roles After: Not set\n"; | ||
} | ||
|
||
return description; | ||
} | ||
} | ||
} |