mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
Add voiceChannelEffectSend event (#3869)
This commit is contained in:
+18
-1
@@ -2,7 +2,14 @@ import type { CreateGatewayManagerOptions, GatewayManager } from '@discordeno/ga
|
||||
import { ShardSocketCloseCodes, createGatewayManager } from '@discordeno/gateway'
|
||||
import type { CreateRestManagerOptions, RestManager } from '@discordeno/rest'
|
||||
import { createRestManager } from '@discordeno/rest'
|
||||
import type { BigString, DiscordGatewayPayload, DiscordReady, GatewayIntents, RecursivePartial } from '@discordeno/types'
|
||||
import type {
|
||||
BigString,
|
||||
DiscordGatewayPayload,
|
||||
DiscordReady,
|
||||
DiscordVoiceChannelEffectAnimationType,
|
||||
GatewayIntents,
|
||||
RecursivePartial,
|
||||
} from '@discordeno/types'
|
||||
import { type Collection, createLogger, getBotIdFromToken, type logger } from '@discordeno/utils'
|
||||
import { createBotGatewayHandlers } from './handlers.js'
|
||||
import { type BotHelpers, createBotHelpers } from './helpers.js'
|
||||
@@ -238,6 +245,16 @@ export interface EventHandlers {
|
||||
reactionRemoveEmoji: (payload: { channelId: bigint; messageId: bigint; guildId?: bigint; emoji: Emoji }) => unknown
|
||||
reactionRemoveAll: (payload: { channelId: bigint; messageId: bigint; guildId?: bigint }) => unknown
|
||||
presenceUpdate: (presence: PresenceUpdate) => unknown
|
||||
voiceChannelEffectSend: (payload: {
|
||||
channelId: bigint
|
||||
guildId: bigint
|
||||
userId: bigint
|
||||
emoji?: Emoji
|
||||
animationType?: DiscordVoiceChannelEffectAnimationType
|
||||
animationId?: number
|
||||
soundId?: bigint | number
|
||||
soundVolume?: number
|
||||
}) => unknown
|
||||
voiceServerUpdate: (payload: { token: string; endpoint?: string; guildId: bigint }) => unknown
|
||||
voiceStateUpdate: (voiceState: VoiceState) => unknown
|
||||
channelCreate: (channel: Channel) => unknown
|
||||
|
||||
@@ -63,6 +63,7 @@ export function createBotGatewayHandlers(
|
||||
THREAD_MEMBERS_UPDATE: options.THREAD_MEMBERS_UPDATE ?? handlers.handleThreadMembersUpdate,
|
||||
TYPING_START: options.TYPING_START ?? handlers.handleTypingStart,
|
||||
USER_UPDATE: options.USER_UPDATE ?? handlers.handleUserUpdate,
|
||||
VOICE_CHANNEL_EFFECT_SEND: options.VOICE_CHANNEL_EFFECT_SEND ?? handlers.handleVoiceChannelEffectSend,
|
||||
VOICE_SERVER_UPDATE: options.VOICE_SERVER_UPDATE ?? handlers.handleVoiceServerUpdate,
|
||||
VOICE_STATE_UPDATE: options.VOICE_STATE_UPDATE ?? handlers.handleVoiceStateUpdate,
|
||||
WEBHOOKS_UPDATE: options.WEBHOOKS_UPDATE ?? handlers.handleWebhooksUpdate,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { DiscordGatewayPayload, DiscordVoiceChannelEffectSend } from '@discordeno/types'
|
||||
import type { Bot } from '../../index.js'
|
||||
|
||||
export async function handleVoiceChannelEffectSend(bot: Bot, data: DiscordGatewayPayload): Promise<void> {
|
||||
if (!bot.events.voiceChannelEffectSend) return
|
||||
|
||||
const payload = data.d as DiscordVoiceChannelEffectSend
|
||||
|
||||
bot.events.voiceChannelEffectSend({
|
||||
guildId: bot.transformers.snowflake(payload.guild_id),
|
||||
channelId: bot.transformers.snowflake(payload.channel_id),
|
||||
userId: bot.transformers.snowflake(payload.user_id),
|
||||
animationType: payload.animation_type ?? undefined,
|
||||
animationId: payload.animation_id ?? undefined,
|
||||
emoji: payload.emoji ? bot.transformers.emoji(bot, payload.emoji) : undefined,
|
||||
soundId: typeof payload.sound_id === 'string' ? bot.transformers.snowflake(payload.sound_id) : payload.sound_id,
|
||||
soundVolume: payload.sound_volume,
|
||||
})
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './VOICE_SERVER_UPDATE.js'
|
||||
export * from './VOICE_STATE_UPDATE.js'
|
||||
export * from './VOICE_CHANNEL_EFFECT_SEND.js'
|
||||
|
||||
@@ -197,6 +197,7 @@ export interface BotGatewayHandlerOptions {
|
||||
PRESENCE_UPDATE: typeof handlers.handlePresenceUpdate
|
||||
TYPING_START: typeof handlers.handleTypingStart
|
||||
USER_UPDATE: typeof handlers.handleUserUpdate
|
||||
VOICE_CHANNEL_EFFECT_SEND: typeof handlers.handleVoiceChannelEffectSend
|
||||
VOICE_SERVER_UPDATE: typeof handlers.handleVoiceServerUpdate
|
||||
VOICE_STATE_UPDATE: typeof handlers.handleVoiceStateUpdate
|
||||
WEBHOOKS_UPDATE: typeof handlers.handleWebhooksUpdate
|
||||
|
||||
@@ -2828,6 +2828,34 @@ export interface DiscordVoiceServerUpdate {
|
||||
endpoint: string | null
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway-events#voice-channel-effect-send-voice-channel-effect-send-event-fields */
|
||||
export interface DiscordVoiceChannelEffectSend {
|
||||
/** 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?: DiscordEmoji | null
|
||||
/** The type of emoji animation, for emoji reaction and soundboard effects */
|
||||
animation_type?: DiscordVoiceChannelEffectAnimationType | null
|
||||
/** The ID of the emoji animation, for emoji reaction and soundboard effects */
|
||||
animation_id?: number | null
|
||||
/** 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
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway-events#voice-channel-effect-send-animation-types */
|
||||
export enum DiscordVoiceChannelEffectAnimationType {
|
||||
/** A fun animation, sent by a Nitro subscriber */
|
||||
Premium = 0,
|
||||
/** The standard animation */
|
||||
Basic = 1,
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#invite-create */
|
||||
export interface DiscordInviteCreate {
|
||||
/** The channel the invite is for */
|
||||
|
||||
@@ -896,6 +896,7 @@ export type GatewayDispatchEventNames =
|
||||
| 'STAGE_INSTANCE_DELETE'
|
||||
| 'TYPING_START'
|
||||
| 'USER_UPDATE'
|
||||
| 'VOICE_CHANNEL_EFFECT_SEND'
|
||||
| 'VOICE_STATE_UPDATE'
|
||||
| 'VOICE_SERVER_UPDATE'
|
||||
| 'WEBHOOKS_UPDATE'
|
||||
@@ -969,6 +970,7 @@ export enum GatewayIntents {
|
||||
GuildInvites = 1 << 6,
|
||||
/**
|
||||
* - VOICE_STATE_UPDATE
|
||||
* - VOICE_CHANNEL_EFFECT_SEND
|
||||
*/
|
||||
GuildVoiceStates = 1 << 7,
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user