diff --git a/src/audit_log.v b/src/audit_log.v index ecc7bd0..4b73f72 100644 --- a/src/audit_log.v +++ b/src/audit_log.v @@ -6,7 +6,6 @@ import x.json2 // The table below lists audit log events and values (the `action_type` field) that your app may receive. // The `Object Changed` column notes which object's values may be included in the entry. Though there are exceptions, possible keys in the `changes` array typically correspond to the object's fields. The descriptions and types for those fields can be found in the linked documentation for the object. // If no object is noted, there won't be a `changes` array in the entry, though other fields like the `target_id` still exist and many have fields in the options array. - pub enum AuditLogEvent { // Server settings were updated guild_update = 1 @@ -119,7 +118,8 @@ pub enum AuditLogEvent { // Creator monetization request was created creator_monetization_request_created = 150 // Creator monetization terms were accepted - creator_monetization_terms_accepted + creator_monetization_terms_accepted = 151 + // Guild Onboarding Question was created onboarding_question_create = 163 // Guild Onboarding Question was updated @@ -130,6 +130,10 @@ pub enum AuditLogEvent { server_guide_create = 190 // Guild Server Guide was updated server_guide_update + // A voice channel status was updated by a user + voice_channel_status_update = 192 + // A voice channel status was deleted by a user + voice_channel_status_delete } pub struct AuditLogChange { @@ -191,6 +195,8 @@ pub: typ ?string // The type of integration which performed the action integration_type ?string + // The new voice channel status + status ?string } pub fn AuditEntryInfo.parse(j json2.Any) !AuditEntryInfo { @@ -257,6 +263,11 @@ pub fn AuditEntryInfo.parse(j json2.Any) !AuditEntryInfo { } else { none } + status: if s := j['status'] { + s as string + } else { + none + } } } else { diff --git a/src/channel.v b/src/channel.v index 245392b..6d6cffe 100644 --- a/src/channel.v +++ b/src/channel.v @@ -513,6 +513,8 @@ pub: name string // the channel topic (0-4096 characters for GUILD_FORUM and GUILD_MEDIA channels, 0-1024 characters for all others) topic ?string + // the voice channel status (0-500 characters) + status ?NullOr[string] // whether the channel is nsfw nsfw ?bool // the id of the last message sent in this channel (or thread for GUILD_FORUM or GUILD_MEDIA channels) (may not point to an existing or valid message or thread) @@ -621,6 +623,15 @@ pub fn Channel.parse(j json2.Any) !Channel { } else { none } + status: if s := j['status'] { + if s !is json2.Null { + some(s as string) + } else { + null[string]() + } + } else { + none + } nsfw: if b := j['nsfw'] { b as bool } else { diff --git a/src/events.v b/src/events.v index 46e804d..830c97c 100644 --- a/src/events.v +++ b/src/events.v @@ -162,6 +162,38 @@ pub fn ChannelDeleteEvent.parse(j json2.Any, base BaseEvent) !ChannelDeleteEvent } } +pub struct VoiceChannelStatusUpdateEvent { + BaseEvent +pub: + // The channel id + id Snowflake + // The guild id + guild_id Snowflake + // The new voice channel status + status ?string +} + +pub fn VoiceChannelStatusUpdateEvent.parse(j json2.Any, base BaseEvent) !VoiceChannelStatusUpdateEvent { + match j { + map[string]json2.Any { + status := j['status']! + return VoiceChannelStatusUpdateEvent{ + BaseEvent: base + id: Snowflake.parse(j['id']!)! + guild_id: Snowflake.parse(j['guild_id']!)! + status: if status !is json2.Null { + status as string + } else { + none + } + } + } + else { + return error('expected VoiceChannelStatusUpdateEvent to be object, got ${j.type_name()}') + } + } +} + pub struct AutoModerationActionExecutionEvent { BaseEvent pub: @@ -1551,6 +1583,7 @@ pub mut: on_channel_create EventController[ChannelCreateEvent] on_channel_update EventController[ChannelUpdateEvent] on_channel_delete EventController[ChannelDeleteEvent] + on_voice_channel_status_update EventController[VoiceChannelStatusUpdateEvent] on_thread_create EventController[ThreadCreateEvent] on_thread_update EventController[ThreadUpdateEvent] on_thread_delete EventController[ThreadDeleteEvent] @@ -1688,6 +1721,13 @@ fn event_process_channel_delete(mut gc GatewayClient, data json2.Any, options Em gc.cache.channels.delete(event.channel.id) } +fn event_process_voice_channel_status_update(mut gc GatewayClient, data json2.Any, options EmitOptions) ! { + gc.events.on_voice_channel_status_update.emit(VoiceChannelStatusUpdateEvent.parse(data, + BaseEvent{ + creator: gc + })!, options) +} + fn event_process_thread_create(mut gc GatewayClient, data json2.Any, options EmitOptions) ! { event := ThreadCreateEvent.parse(data, BaseEvent{ creator: gc @@ -2230,6 +2270,7 @@ const events_table = EventsTable({ 'CHANNEL_CREATE': event_process_channel_create 'CHANNEL_UPDATE': event_process_channel_update 'CHANNEL_DELETE': event_process_channel_delete + 'VOICE_CHANNEL_STATUS_UPDATE': event_process_voice_channel_status_update 'THREAD_CREATE': event_process_thread_create 'THREAD_UPDATE': event_process_thread_update 'THREAD_DELETE': event_process_thread_delete diff --git a/src/permissions.v b/src/permissions.v index 21722f5..0e10428 100644 --- a/src/permissions.v +++ b/src/permissions.v @@ -98,6 +98,9 @@ pub enum Permissions as u64 { use_external_sounds // Allows sending voice messages send_voice_messages + reserved_17 + // Allows setting voice channel status + set_voice_channel_status } pub fn Permissions.all() Permissions {