Skip to content

Commit

Permalink
feat(voice): emit users connect event (abalabahaha#1548)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah authored Oct 4, 2024
1 parent 4a0b02f commit 68e8436
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ declare namespace Eris {
speakingStop: [userID: string];
start: [];
unknown: [packet: RawPacket];
usersConnect: [userIDs: string[]];
userDisconnect: [userID: string];
warn: [message: string];
}
Expand Down
4 changes: 3 additions & 1 deletion lib/Constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,9 @@ export default interface Constants {
RESUME: 7;
HELLO: 8;
RESUMED: 9;
// Unknown 10-12
// Unknown 10
CLIENTS_CONNECT: 11;
// Unknown 12
CLIENT_DISCONNECT: 13;
/** @deprecated */
DISCONNECT: 13;
Expand Down
4 changes: 3 additions & 1 deletion lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,9 @@ module.exports.VoiceOPCodes = {
RESUME: 7,
HELLO: 8,
RESUMED: 9,
// Unknown 10-12
// Unknown 10
CLIENTS_CONNECT: 11,
// Unknown 12
CLIENT_DISCONNECT: 13,
/** @deprecated */
DISCONNECT: 13,
Expand Down
9 changes: 9 additions & 0 deletions lib/voice/VoiceConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,15 @@ class VoiceConnection extends EventEmitter {
this.heartbeat();
break;
}
case VoiceOPCodes.CLIENTS_CONNECT: {
/**
* Fired when one or more clients connect to the voice channel
* @event VoiceConnection#usersConnect
* @prop {String[]} userIDs The IDs of the users that connected
*/
this.emit("usersConnect", packet.d.user_ids);
break;
}
case VoiceOPCodes.CLIENT_DISCONNECT: {
if (this.opus) {
// opusscript requires manual cleanup
Expand Down

0 comments on commit 68e8436

Please sign in to comment.