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
feat: support voiceChannelEffectSend
event
#9308
Open
jaw0r3k
wants to merge
5
commits into
discordjs:v13
Choose a base branch
from
jaw0r3k:v13-voiceEffectSend
base: v13
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+145
−1
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const Action = require('./Action'); | ||
const VoiceChannelEffect = require('../../../structures/VoiceChannelEffect'); | ||
const Events = require('../../../util/Events'); | ||
|
||
class VoiceChannelEffectSendAction extends Action { | ||
handle(data) { | ||
const client = this.client; | ||
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 current user 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)); | ||
} | ||
} | ||
|
||
module.exports = VoiceChannelEffectSendAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = (client, packet) => { | ||
client.actions.VoiceChannelEffectSend.handle(packet.d); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
'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 {?AnimationType} | ||
*/ | ||
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.cache.get(this.channelId) ?? null; | ||
} | ||
|
||
/** | ||
* The member that sent the effect. | ||
* @type {?GuildMember} | ||
* @readonly | ||
*/ | ||
get member() { | ||
return this.guild.members.cache.get(this.userId) ?? null; | ||
} | ||
} | ||
|
||
module.exports = VoiceChannelEffect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User getterSee 9228 (comment)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized this doesn't extend Base, would that be possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk structure was copied from jiralite pr lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About user getter i wasnt sure
its a guild object so like e.g. voice state it doesnt have user