diff --git a/index.d.ts b/index.d.ts index d854c3fe..a0df4631 100644 --- a/index.d.ts +++ b/index.d.ts @@ -193,6 +193,7 @@ declare namespace Dysnomia { // Voice type ConverterCommand = "./ffmpeg" | "./avconv" | "ffmpeg" | "avconv"; type StageInstancePrivacyLevel = Constants["StageInstancePrivacyLevel"][keyof Constants["StageInstancePrivacyLevel"]]; + type VoiceChannelEffectAnimationType = Constants["VoiceChannelEffectAnimationTypes"][keyof Constants["VoiceChannelEffectAnimationTypes"]]; // Webhook type MessageWebhookContent = Pick; @@ -729,6 +730,16 @@ declare namespace Dysnomia { selfStream: boolean; selfVideo: boolean; } + interface VoiceChannelEffect { + guild: Guild | Uncached; + channel: AnyVoiceChannel | Uncached; + user: User | Uncached; + emoji?: PartialEmoji; + animationType?: VoiceChannelEffectAnimationType; + animationID?: number; + soundID?: string | number; + soundVolume?: number; + } interface EventListeners { applicationCommandPermissionsUpdate: [applicationCommandPermissions: GuildApplicationCommandPermissions]; autoModerationActionExecution: [guild: Guild, action: AutoModerationActionExecution]; @@ -805,6 +816,7 @@ declare namespace Dysnomia { unavailableGuildCreate: [guild: UnavailableGuild]; unknown: [packet: RawPacket, id?: number]; userUpdate: [user: User, oldUser: OldUser | null]; + voiceChannelEffectSend: [effect: VoiceChannelEffect]; voiceChannelJoin: [member: Member, channel: AnyVoiceChannel]; voiceChannelLeave: [member: Member, channel: AnyVoiceChannel]; voiceChannelSwitch: [member: Member, newChannel: AnyVoiceChannel, oldChannel: AnyVoiceChannel]; @@ -2554,6 +2566,10 @@ declare namespace Dysnomia { 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 6eac3348..59978a2b 100644 --- a/lib/Constants.js +++ b/lib/Constants.js @@ -797,6 +797,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 97e8535a..c4ffbbbb 100644 --- a/lib/gateway/Shard.js +++ b/lib/gateway/Shard.js @@ -843,6 +843,35 @@ class Shard extends EventEmitter { } 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 {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 {TextVoiceChannel | 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 {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 + * @prop {Object?} effect.emoji The emoji sent + * @prop {Number?} effect.animationType The animation type + * @prop {Number?} effect.animationID The animation ID + * @prop {(String | Number)?} effect.soundID The sound ID + * @prop {Number?} effect.soundVolume The volume of the sound (a number between 0 and 1) + */ + 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);