diff --git a/index.d.ts b/index.d.ts index 3d5878355..1ca20a75a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -191,6 +191,7 @@ declare namespace Eris { // Voice type ConverterCommand = "./ffmpeg" | "./avconv" | "ffmpeg" | "avconv"; type StageInstancePrivacyLevel = Constants["StageInstancePrivacyLevel"][keyof Constants["StageInstancePrivacyLevel"]]; + type VoiceChannelEffectAnimationType = Constants["VoiceChannelEffectAnimationTypes"][keyof Constants["VoiceChannelEffectAnimationTypes"]]; // Webhook type WebhookPayloadEdit = Pick; @@ -937,6 +938,7 @@ declare namespace Eris { unavailableGuildCreate: [guild: UnavailableGuild]; unknown: [packet: RawPacket, id?: number]; userUpdate: [user: User, oldUser: PartialUser | null]; + voiceChannelEffectSend: [effect: VoiceChannelEffect]; voiceChannelJoin: [member: Member, channel: AnyVoiceChannel]; voiceChannelLeave: [member: Member, channel: AnyVoiceChannel]; voiceChannelStatusUpdate: [channel: AnyVoiceChannel, oldChannel: VoiceStatus]; @@ -1828,6 +1830,16 @@ declare namespace Eris { id: string; voiceState: OldVoiceState; } + interface VoiceChannelEffect { + animationID?: number; + animationType?: VoiceChannelEffectAnimationType | null; + channel: PossiblyUncachedSpeakableChannel; + emoji?: PartialEmoji | null; + guild: PossiblyUncachedGuild; + soundID?: string | number; + soundVolume?: number; + user: User | Uncached; + } interface VoiceConnectData { channel_id: string; endpoint: string; diff --git a/lib/Constants.d.ts b/lib/Constants.d.ts index c9111d111..799685b8a 100644 --- a/lib/Constants.d.ts +++ b/lib/Constants.d.ts @@ -675,6 +675,10 @@ export default interface Constants { AUTO: 1; FULL: 2; }; + VoiceChannelEffectAnimationTypes: { + PREMIUM: 0; + BASIC: 1; + }; VoiceOPCodes: { IDENTIFY: 0; SELECT_PROTOCOL: 1; diff --git a/lib/Constants.js b/lib/Constants.js index 5e3754527..2fbc8ce0e 100644 --- a/lib/Constants.js +++ b/lib/Constants.js @@ -852,6 +852,11 @@ module.exports.VideoQualityModes = { FULL: 2, }; +module.exports.VoiceChannelEffectAnimationTypes = { + PREMIUM: 0, + BASIC: 1, +}; + module.exports.VoiceOPCodes = { IDENTIFY: 0, SELECT_PROTOCOL: 1, diff --git a/lib/gateway/Shard.js b/lib/gateway/Shard.js index 795af9b12..f9810d7c3 100644 --- a/lib/gateway/Shard.js +++ b/lib/gateway/Shard.js @@ -911,6 +911,35 @@ class Shard extends EventEmitter { this.emit("voiceChannelStatusUpdate", channel, oldChannel); break; } + case "VOICE_CHANNEL_EFFECT_SEND": { + const channel = this.client.getChannel(packet.d.channel_id) || { id: packet.d.channel_id }; + const guild = this.client.guilds.get(packet.d.guild_id) || { id: packet.d.guild_id }; + const user = this.client.users.get(packet.d.user_id) || { id: packet.d.user_id }; + /** + * Fired when a user sends a voice channel effect + * @event Client#voiceChannelEffectSend + * @prop {Object} effect The effect that was sent + * @prop {Number?} effect.animationID The animation ID + * @prop {Number?} effect.animationType The animation type + * @prop {VoiceChannel | StageChannel | Object} effect.channel The voice channel the effect was sent in. If the channel is not cached, this will be an object with an `id` key. No other property is guaranteed + * @prop {Object?} effect.emoji The emoji sent + * @prop {Guild | Object} effect.guild The guild the effect was sent in. If the guild is not cached, this will be an object with an `id` key. No other property is guaranteed + * @prop {(String | Number)?} effect.soundID The sound ID + * @prop {Number?} effect.soundVolume The volume of the sound (a number between 0 and 1) + * @prop {User | Object} effect.user The user that sent the effect. If the user is not cached, this will be an object with an `id` key. No other property is guaranteed + */ + this.emit("voiceChannelEffectSend", { + channel: channel, + guild: guild, + user: user, + emoji: packet.d.emoji, + animationType: packet.d.animation_type, + animationID: packet.d.animation_id, + soundID: packet.d.sound_id, + soundVolume: packet.d.sound_volume, + }); + break; + } case "TYPING_START": { let member = null; const guild = this.client.guilds.get(packet.d.guild_id);