diff --git a/src/events/hooks/voice.ts b/src/events/hooks/voice.ts index bc4608d..31abb7b 100644 --- a/src/events/hooks/voice.ts +++ b/src/events/hooks/voice.ts @@ -1,4 +1,8 @@ -import type { GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData } from '../../types'; +import type { + GatewayVoiceChannelEffectSendDispachData, + GatewayVoiceServerUpdateDispatchData, + GatewayVoiceStateUpdateDispatchData, +} from '../../types'; import { toCamelCase } from '../../common'; import type { UsingClient } from '../../commands'; import { Transformers, type VoiceStateStructure } from '../../client/transformers'; @@ -14,3 +18,7 @@ export const VOICE_STATE_UPDATE = async ( if (!data.guild_id) return [Transformers.VoiceState(self, data)]; return [Transformers.VoiceState(self, data), await self.cache.voiceStates?.get(data.user_id, data.guild_id)]; }; + +export const VOICE_CHANNEL_EFFECT_SEND = (_self: UsingClient, data: GatewayVoiceChannelEffectSendDispachData) => { + return toCamelCase(data); +}; diff --git a/src/types/gateway.ts b/src/types/gateway.ts index 522af65..e92888b 100644 --- a/src/types/gateway.ts +++ b/src/types/gateway.ts @@ -32,9 +32,10 @@ import type { AutoModerationRuleTriggerType, APIAuditLogEntry, APIEntitlement, + APIPartialEmoji, } from './payloads/index'; import type { ReactionType } from './rest/index'; -import type { Nullable } from './utils'; +import type { AnimationTypes, Nullable } from './utils'; /** * https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-query-string-params @@ -1496,6 +1497,47 @@ export type GatewayUserUpdateDispatch = DataPayload; + +/** + * https://discord.com/developers/docs/topics/gateway-events#voice-channel-effect-send-voice-channel-effect-send-event-fields + */ +export type GatewayVoiceChannelEffectSendDispachData = + | GatewayVoiceChannelEffectSendSoundboard + | GatewayVoiceChannelEffectSendReaction; + +export type _GatewayVoiceChannelEffectSendDispachData = { + /** ID of the channel the effect was sent in */ + channel_id: string; + /** ID of the guild the effect was sent in */ + guild_id: string; + /** ID of the user who sent the effect */ + user_id: string; + /** The emoji sent, for emoji reaction and soundboard effects */ + emoji?: APIPartialEmoji | null; + /** The type of emoji animation, for emoji reaction and soundboard effects */ + animation_type?: AnimationTypes | null; + /** The ID of the emoji animation, for emoji reaction and soundboard effects */ + animation_id?: number; + /** The ID of the soundboard sound, for soundboard effects */ + sound_id: string | number; + /** The volume of the soundboard sound, from 0 to 1, for soundboard effects */ + sound_volume?: number; +}; + +export type GatewayVoiceChannelEffectSendReaction = Omit< + _GatewayVoiceChannelEffectSendDispachData, + 'sound_id' | 'sound_volume' +>; + +export type GatewayVoiceChannelEffectSendSoundboard = _GatewayVoiceChannelEffectSendDispachData; + /** * https://discord.com/developers/docs/topics/gateway-events#voice-state-update */ diff --git a/src/types/utils/index.ts b/src/types/utils/index.ts index 8cd401f..e6cd835 100644 --- a/src/types/utils/index.ts +++ b/src/types/utils/index.ts @@ -367,6 +367,7 @@ export enum GatewayDispatchEvents { ThreadUpdate = 'THREAD_UPDATE', TypingStart = 'TYPING_START', UserUpdate = 'USER_UPDATE', + VoiceChannelEffectSend = 'VOICE_CHANNEL_EFFECT_SEND', VoiceServerUpdate = 'VOICE_SERVER_UPDATE', VoiceStateUpdate = 'VOICE_STATE_UPDATE', WebhooksUpdate = 'WEBHOOKS_UPDATE', @@ -835,3 +836,13 @@ export enum OverwriteType { Role, Member, } + +/** + * https://discord.com/developers/docs/topics/gateway-events#voice-channel-effect-send-animation-types + */ +export enum AnimationTypes { + /** A fun animation, sent by a Nitro subscriber */ + PREMIUM = 0, + /** The standard animation */ + BASIC, +} diff --git a/src/websocket/SharedTypes.ts b/src/websocket/SharedTypes.ts index 41d515e..fa76d20 100644 --- a/src/websocket/SharedTypes.ts +++ b/src/websocket/SharedTypes.ts @@ -58,6 +58,7 @@ import type { APIChannel, APIAutoModerationRule, APIEntitlement, + GatewayVoiceChannelEffectSendDispachData, } from '../types'; import { GatewayDispatchEvents } from '../types'; @@ -141,6 +142,7 @@ export interface Events { [GatewayDispatchEvents.PresenceUpdate]: GatewayPresenceUpdateDispatchData; [GatewayDispatchEvents.TypingStart]: GatewayTypingStartDispatchData; [GatewayDispatchEvents.UserUpdate]: GatewayUserUpdateDispatchData; + [GatewayDispatchEvents.VoiceChannelEffectSend]: GatewayVoiceChannelEffectSendDispachData; [GatewayDispatchEvents.VoiceStateUpdate]: GatewayVoiceStateUpdateData; [GatewayDispatchEvents.VoiceServerUpdate]: GatewayVoiceServerUpdateDispatchData; [GatewayDispatchEvents.WebhooksUpdate]: GatewayWebhooksUpdateDispatchData;