Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebhookPayload, "content" | "embeds" | "allowedMentions" | "components" | "attachments" | "threadID">;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -2554,6 +2566,10 @@ declare namespace Dysnomia {
AUTO: 1;
FULL: 2;
};
VoiceChannelEffectAnimationTypes: {
PREMIUM: 0;
BASIC: 1;
};
VoiceOPCodes: {
IDENTIFY: 0;
SELECT_PROTOCOL: 1;
Expand Down
5 changes: 5 additions & 0 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,11 @@ module.exports.VideoQualityModes = {
FULL: 2
};

module.exports.VoiceChannelEffectAnimationTypes = {
PREMIUM: 0,
BASIC: 1
};

module.exports.VoiceOPCodes = {
IDENTIFY: 0,
SELECT_PROTOCOL: 1,
Expand Down
29 changes: 29 additions & 0 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down