/
SocketWebhookCreateAuditLogData.cs
71 lines (60 loc) · 2.02 KB
/
SocketWebhookCreateAuditLogData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Discord.Rest;
using EntryModel = Discord.API.AuditLogEntry;
using Model = Discord.API.AuditLogs.WebhookInfoAuditLogModel;
namespace Discord.WebSocket;
/// <summary>
/// Contains a piece of audit log data related to a webhook creation.
/// </summary>
public class SocketWebhookCreateAuditLogData : ISocketAuditLogData
{
private SocketWebhookCreateAuditLogData(ulong webhookId, Model model)
{
WebhookId = webhookId;
Name = model.Name;
Type = model.Type!.Value;
ChannelId = model.ChannelId!.Value;
Avatar = model.AvatarHash;
}
internal static SocketWebhookCreateAuditLogData Create(DiscordSocketClient discord, EntryModel entry)
{
var changes = entry.Changes;
var (_, data) = AuditLogHelper.CreateAuditLogEntityInfo<Model>(changes, discord);
return new SocketWebhookCreateAuditLogData(entry.TargetId!.Value, data);
}
/// <summary>
/// Gets the webhook id.
/// </summary>
/// <returns>
/// The webhook identifier.
/// </returns>
public ulong WebhookId { get; }
/// <summary>
/// Gets the type of webhook that was created.
/// </summary>
/// <returns>
/// The type of webhook that was created.
/// </returns>
public WebhookType Type { get; }
/// <summary>
/// Gets the name of the webhook.
/// </summary>
/// <returns>
/// A string containing the name of the webhook.
/// </returns>
public string Name { get; }
/// <summary>
/// Gets the ID of the channel that the webhook could send to.
/// </summary>
/// <returns>
/// A <see cref="ulong"/> representing the snowflake identifier of the channel that the webhook could send
/// to.
/// </returns>
public ulong ChannelId { get; }
/// <summary>
/// Gets the hash value of the webhook's avatar.
/// </summary>
/// <returns>
/// A string containing the hash of the webhook's avatar.
/// </returns>
public string Avatar { get; }
}