diff --git a/discord/audit_log.go b/discord/audit_log.go index 83ec3277..574f7220 100644 --- a/discord/audit_log.go +++ b/discord/audit_log.go @@ -117,6 +117,7 @@ const ( // AuditLog (https://discord.com/developers/docs/resources/audit-log) These are logs of events that occurred, accessible via the Discord type AuditLog struct { + ApplicationCommands []ApplicationCommand `json:"application_commands"` AuditLogEntries []AuditLogEntry `json:"audit_log_entries"` AutoModerationRules []AutoModerationRule `json:"auto_moderation_rules"` GuildScheduledEvents []GuildScheduledEvent `json:"guild_scheduled_events"` @@ -129,9 +130,10 @@ type AuditLog struct { func (l *AuditLog) UnmarshalJSON(data []byte) error { type auditLog AuditLog var v struct { - Integrations []UnmarshalIntegration `json:"integrations"` - Threads []UnmarshalChannel `json:"threads"` - Webhooks []UnmarshalWebhook `json:"webhooks"` + ApplicationCommands []UnmarshalApplicationCommand `json:"application_commands"` + Integrations []UnmarshalIntegration `json:"integrations"` + Threads []UnmarshalChannel `json:"threads"` + Webhooks []UnmarshalWebhook `json:"webhooks"` auditLog } if err := json.Unmarshal(data, &v); err != nil { @@ -139,6 +141,13 @@ func (l *AuditLog) UnmarshalJSON(data []byte) error { } *l = AuditLog(v.auditLog) + if v.ApplicationCommands != nil { + l.ApplicationCommands = make([]ApplicationCommand, len(v.ApplicationCommands)) + for i := range v.ApplicationCommands { + l.ApplicationCommands[i] = v.ApplicationCommands[i].ApplicationCommand + } + } + if v.Integrations != nil { l.Integrations = make([]Integration, len(v.Integrations)) for i := range v.Integrations {