-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: Voice Channel Send Effects #9288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
93968d2
f8d473d
57f960d
79617a5
7dda110
7e6b004
4a1e935
457e971
1d01821
506adb0
b27c1d0
f932634
f19b0df
d4ffe1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| 'use strict'; | ||
|
|
||
| const VoiceChannelEffect = require('../../../structures/VoiceChannelEffect'); | ||
| const Events = require('../../../util/Events'); | ||
|
|
||
| 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.VoiceChannelEffectSend, new VoiceChannelEffect(data, guild)); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| 'use strict'; | ||
|
|
||
| const { Emoji } = require('./Emoji'); | ||
|
|
||
| /** | ||
| * Represents an effect used in a {@link VoiceChannel}. | ||
| */ | ||
| class VoiceChannelEffect { | ||
This comment was marked as outdated.
Sorry, something went wrong.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not. Extending |
||
| 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; | ||
|
|
||
| // TODO: Revise after discord-api-types. | ||
| /** | ||
| * The animation type of the effect. | ||
| * @type {?number} | ||
| */ | ||
| this.animationType = data.animation_type ?? null; | ||
|
|
||
| /** | ||
| * The animation id of the effect. | ||
| * @type {?number} | ||
| */ | ||
| this.animationId = data.animation_id ?? null; | ||
| } | ||
|
|
||
| /** | ||
| * The channel the effect was sent in. | ||
| * @type {?VoiceChannel} | ||
| * @readonly | ||
| */ | ||
| get channel() { | ||
| return this.guild.channels.resolve(this.channelId); | ||
| } | ||
| } | ||
|
|
||
| module.exports = VoiceChannelEffect; | ||
Uh oh!
There was an error while loading. Please reload this page.