From 5962c59684aa50f5bfc8e1e16e91206fa935a854 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Fri, 26 Jan 2024 20:26:39 +0700 Subject: [PATCH] feat: VoiceChannel Status --- .../handlers/VOICE_CHANNEL_STATUS_UPDATE.js | 12 ++++++++++++ src/client/websocket/handlers/index.js | 1 + src/structures/BaseGuildVoiceChannel.js | 8 ++++++++ 3 files changed, 21 insertions(+) create mode 100644 src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js diff --git a/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js b/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js new file mode 100644 index 00000000..266af47 --- /dev/null +++ b/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js @@ -0,0 +1,12 @@ +'use strict'; + +const { Events } = require('../../../util/Constants'); + +module.exports = (client, { d: data }) => { + const channel = client.channels.cache.get(data.id); + if (channel) { + const old = channel._clone(); + channel.status = data.status; + client.emit(Events.CHANNEL_UPDATE, old, channel); + } +}; diff --git a/src/client/websocket/handlers/index.js b/src/client/websocket/handlers/index.js index 45423cd..f01d263 100644 --- a/src/client/websocket/handlers/index.js +++ b/src/client/websocket/handlers/index.js @@ -75,6 +75,7 @@ const handlers = Object.fromEntries([ ['CALL_DELETE', require('./CALL_DELETE')], ['USER_SETTINGS_UPDATE', require('./USER_SETTINGS_UPDATE')], ['USER_GUILD_SETTINGS_UPDATE', require('./USER_GUILD_SETTINGS_UPDATE')], + ['VOICE_CHANNEL_STATUS_UPDATE', require('./VOICE_CHANNEL_STATUS_UPDATE')], ]); module.exports = handlers; diff --git a/src/structures/BaseGuildVoiceChannel.js b/src/structures/BaseGuildVoiceChannel.js index d653e7a..f48f0de 100644 --- a/src/structures/BaseGuildVoiceChannel.js +++ b/src/structures/BaseGuildVoiceChannel.js @@ -90,6 +90,14 @@ class BaseGuildVoiceChannel extends GuildChannel { if ('nsfw' in data) { this.nsfw = data.nsfw; } + + if ('status' in data) { + /** + * The status of the voice channel (max 500 characters) + * @type {?string} + */ + this.status = data.status; + } } /**