16
src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js
Normal file
16
src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const VoiceChannelEffect = require('../../../structures/VoiceChannelEffect');
|
||||||
|
const { Events } = require('../../../util/Constants');
|
||||||
|
|
||||||
|
module.exports = (client, { d: data }) => {
|
||||||
|
const guild = client.guilds.cache.get(data.guild_id);
|
||||||
|
if (!guild) return;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emmited when someone sends an effect, such as an emoji reaction, in a voice channel the client is connected to.
|
||||||
|
* @event Client#voiceChannelEffectSend
|
||||||
|
* @param {VoiceChannelEffect} voiceChannelEffect The sent voice channel effect
|
||||||
|
*/
|
||||||
|
client.emit(Events.VOICE_CHANNEL_EFFECT_SEND, new VoiceChannelEffect(data, guild));
|
||||||
|
};
|
||||||
@@ -48,6 +48,7 @@ const handlers = Object.fromEntries([
|
|||||||
['USER_UPDATE', require('./USER_UPDATE')],
|
['USER_UPDATE', require('./USER_UPDATE')],
|
||||||
['PRESENCE_UPDATE', require('./PRESENCE_UPDATE')],
|
['PRESENCE_UPDATE', require('./PRESENCE_UPDATE')],
|
||||||
['TYPING_START', require('./TYPING_START')],
|
['TYPING_START', require('./TYPING_START')],
|
||||||
|
['VOICE_CHANNEL_EFFECT_SEND', require('./VOICE_CHANNEL_EFFECT_SEND')],
|
||||||
['VOICE_STATE_UPDATE', require('./VOICE_STATE_UPDATE')],
|
['VOICE_STATE_UPDATE', require('./VOICE_STATE_UPDATE')],
|
||||||
['VOICE_SERVER_UPDATE', require('./VOICE_SERVER_UPDATE')],
|
['VOICE_SERVER_UPDATE', require('./VOICE_SERVER_UPDATE')],
|
||||||
['WEBHOOKS_UPDATE', require('./WEBHOOKS_UPDATE')],
|
['WEBHOOKS_UPDATE', require('./WEBHOOKS_UPDATE')],
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ exports.ThreadMember = require('./structures/ThreadMember');
|
|||||||
exports.Typing = require('./structures/Typing');
|
exports.Typing = require('./structures/Typing');
|
||||||
exports.User = require('./structures/User');
|
exports.User = require('./structures/User');
|
||||||
exports.VoiceChannel = require('./structures/VoiceChannel');
|
exports.VoiceChannel = require('./structures/VoiceChannel');
|
||||||
|
exports.VoiceChannelEffect = require('./structures/VoiceChannelEffect');
|
||||||
exports.VoiceRegion = require('./structures/VoiceRegion');
|
exports.VoiceRegion = require('./structures/VoiceRegion');
|
||||||
exports.VoiceState = require('./structures/VoiceState');
|
exports.VoiceState = require('./structures/VoiceState');
|
||||||
exports.Webhook = require('./structures/Webhook');
|
exports.Webhook = require('./structures/Webhook');
|
||||||
|
|||||||
69
src/structures/VoiceChannelEffect.js
Normal file
69
src/structures/VoiceChannelEffect.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { Emoji } = require('./Emoji');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an effect used in a {@link VoiceChannel}.
|
||||||
|
*/
|
||||||
|
class VoiceChannelEffect {
|
||||||
|
constructor(data, guild) {
|
||||||
|
/**
|
||||||
|
* The guild where the effect was sent from.
|
||||||
|
* @type {Guild}
|
||||||
|
*/
|
||||||
|
this.guild = guild;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the channel the effect was sent in.
|
||||||
|
* @type {Snowflake}
|
||||||
|
*/
|
||||||
|
this.channelId = data.channel_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the user that sent the effect.
|
||||||
|
* @type {Snowflake}
|
||||||
|
*/
|
||||||
|
this.userId = data.user_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The emoji of the effect.
|
||||||
|
* @type {?Emoji}
|
||||||
|
*/
|
||||||
|
this.emoji = data.emoji ? new Emoji(guild.client, data.emoji) : null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation type of the effect.
|
||||||
|
* @type {?VoiceChannelEffectSendAnimationType}
|
||||||
|
*/
|
||||||
|
this.animationType = data.animation_type ?? null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation id of the effect.
|
||||||
|
* @type {?number}
|
||||||
|
*/
|
||||||
|
this.animationId = data.animation_id ?? null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the soundboard sound for soundboard effects.
|
||||||
|
* @type {?(Snowflake|number)}
|
||||||
|
*/
|
||||||
|
this.soundId = data.sound_id ?? null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The volume of the soundboard sound [0-1] for soundboard effects.
|
||||||
|
* @type {?number}
|
||||||
|
*/
|
||||||
|
this.soundVolume = data.sound_volume ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The channel the effect was sent in.
|
||||||
|
* @type {?VoiceChannel}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get channel() {
|
||||||
|
return this.guild.channels.cache.get(this.channelId) ?? null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = VoiceChannelEffect;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @external MessageActivityType
|
* @external MessageActivityType
|
||||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v9/enum/MessageActivityType}
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/MessageActivityType}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,3 +17,8 @@
|
|||||||
* @external TeamMemberRole
|
* @external TeamMemberRole
|
||||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberRole}
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberRole}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @external VoiceChannelEffectSendAnimationType
|
||||||
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/VoiceChannelEffectSendAnimationType}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -380,6 +380,7 @@ exports.VoiceOpcodes = {
|
|||||||
* * CALL_CREATE: callCreate
|
* * CALL_CREATE: callCreate
|
||||||
* * CALL_UPDATE: callUpdate
|
* * CALL_UPDATE: callUpdate
|
||||||
* * CALL_DELETE: callDelete
|
* * CALL_DELETE: callDelete
|
||||||
|
* * VOICE_CHANNEL_EFFECT_SEND: voiceChannelEffectSend
|
||||||
* @typedef {Object<string, string>} Events
|
* @typedef {Object<string, string>} Events
|
||||||
*/
|
*/
|
||||||
exports.Events = {
|
exports.Events = {
|
||||||
@@ -476,6 +477,7 @@ exports.Events = {
|
|||||||
CALL_DELETE: 'callDelete',
|
CALL_DELETE: 'callDelete',
|
||||||
MESSAGE_POLL_VOTE_ADD: 'messagePollVoteAdd',
|
MESSAGE_POLL_VOTE_ADD: 'messagePollVoteAdd',
|
||||||
MESSAGE_POLL_VOTE_REMOVE: 'messagePollVoteRemove',
|
MESSAGE_POLL_VOTE_REMOVE: 'messagePollVoteRemove',
|
||||||
|
VOICE_CHANNEL_EFFECT_SEND: 'voiceChannelEffectSend',
|
||||||
// Djs v12
|
// Djs v12
|
||||||
VOICE_BROADCAST_SUBSCRIBE: 'subscribe',
|
VOICE_BROADCAST_SUBSCRIBE: 'subscribe',
|
||||||
VOICE_BROADCAST_UNSUBSCRIBE: 'unsubscribe',
|
VOICE_BROADCAST_UNSUBSCRIBE: 'unsubscribe',
|
||||||
|
|||||||
22
typings/index.d.ts
vendored
22
typings/index.d.ts
vendored
@@ -60,8 +60,11 @@ import {
|
|||||||
GuildScheduledEventRecurrenceRuleWeekday,
|
GuildScheduledEventRecurrenceRuleWeekday,
|
||||||
GuildScheduledEventRecurrenceRuleMonth,
|
GuildScheduledEventRecurrenceRuleMonth,
|
||||||
GuildScheduledEventRecurrenceRuleFrequency,
|
GuildScheduledEventRecurrenceRuleFrequency,
|
||||||
APIChatInputApplicationCommandInteractionData, APIContextMenuInteractionData,
|
APIChatInputApplicationCommandInteractionData,
|
||||||
ReactionType
|
APIContextMenuInteractionData,
|
||||||
|
ReactionType,
|
||||||
|
VoiceChannelEffectSendAnimationType,
|
||||||
|
GatewayVoiceChannelEffectSendDispatchData,
|
||||||
} from 'discord-api-types/v10';
|
} from 'discord-api-types/v10';
|
||||||
import { ChildProcess, ChildProcessWithoutNullStreams } from 'node:child_process';
|
import { ChildProcess, ChildProcessWithoutNullStreams } from 'node:child_process';
|
||||||
import { EventEmitter } from 'node:events';
|
import { EventEmitter } from 'node:events';
|
||||||
@@ -3665,6 +3668,19 @@ export class VoiceChannel extends BaseGuildVoiceChannel {
|
|||||||
public type: 'GUILD_VOICE';
|
public type: 'GUILD_VOICE';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class VoiceChannelEffect {
|
||||||
|
private constructor(data: GatewayVoiceChannelEffectSendDispatchData, guild: Guild);
|
||||||
|
public guild: Guild;
|
||||||
|
public channelId: Snowflake;
|
||||||
|
public userId: Snowflake;
|
||||||
|
public emoji: Emoji | null;
|
||||||
|
public animationType: VoiceChannelEffectSendAnimationType | null;
|
||||||
|
public animationId: number | null;
|
||||||
|
public soundId: Snowflake | number | null;
|
||||||
|
public soundVolume: number | null;
|
||||||
|
public get channel(): VoiceChannel | null;
|
||||||
|
}
|
||||||
|
|
||||||
export class VoiceRegion {
|
export class VoiceRegion {
|
||||||
private constructor(data: RawVoiceRegionData);
|
private constructor(data: RawVoiceRegionData);
|
||||||
public custom: boolean;
|
public custom: boolean;
|
||||||
@@ -5687,6 +5703,7 @@ export interface ClientEvents extends BaseClientEvents {
|
|||||||
threadUpdate: [oldThread: ThreadChannel, newThread: ThreadChannel];
|
threadUpdate: [oldThread: ThreadChannel, newThread: ThreadChannel];
|
||||||
typingStart: [typing: Typing];
|
typingStart: [typing: Typing];
|
||||||
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
||||||
|
voiceChannelEffectSend: [voiceChannelEffect: VoiceChannelEffect];
|
||||||
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
||||||
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | MediaChannel | StageChannel];
|
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | MediaChannel | StageChannel];
|
||||||
shardDisconnect: [closeEvent: CloseEvent, shardId: number];
|
shardDisconnect: [closeEvent: CloseEvent, shardId: number];
|
||||||
@@ -5978,6 +5995,7 @@ export interface ConstantsEvents {
|
|||||||
THREAD_MEMBERS_UPDATE: 'threadMembersUpdate';
|
THREAD_MEMBERS_UPDATE: 'threadMembersUpdate';
|
||||||
USER_UPDATE: 'userUpdate';
|
USER_UPDATE: 'userUpdate';
|
||||||
PRESENCE_UPDATE: 'presenceUpdate';
|
PRESENCE_UPDATE: 'presenceUpdate';
|
||||||
|
VOICE_CHANNEL_EFFECT_SEND: 'voiceChannelEffectSend';
|
||||||
VOICE_SERVER_UPDATE: 'voiceServerUpdate';
|
VOICE_SERVER_UPDATE: 'voiceServerUpdate';
|
||||||
VOICE_STATE_UPDATE: 'voiceStateUpdate';
|
VOICE_STATE_UPDATE: 'voiceStateUpdate';
|
||||||
TYPING_START: 'typingStart';
|
TYPING_START: 'typingStart';
|
||||||
|
|||||||
Reference in New Issue
Block a user