discord-player-play-dl/src/Queue.js

76 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-01-12 00:01:18 +05:00
const { EventEmitter } = require('events');
/**
* Represents a guild queue.
*/
class Queue extends EventEmitter {
/**
* Represents a guild queue.
* @param {string} guildID
*/
constructor(guildID){
super();
/**
* The guild ID.
* @type {Snowflake}
*/
this.guildID = guildID;
/**
* The stream dispatcher.
* @type {StreamDispatcher}
*/
this.dispatcher = null;
/**
* The voice connection.
* @type {VoiceConnection}
*/
this.connection = null;
/**
* Songs. The first one is currently playing and the rest is going to be played.
* @type {Song[]}
*/
this.songs = [];
/**
* Whether the stream is currently stopped.
* @type {Boolean}
*/
this.stopped = false;
/**
* Whether the last song was skipped.
* @type {Boolean}
*/
this.skipped = false;
/**
* The stream volume.
* @type {Number}
*/
this.volume = 100;
/**
* Whether the stream is currently playing.
* @type {Boolean}
*/
this.playing = true;
}
};
/**
* Emitted when the queue is empty.
* @event Queue#end
*/
2020-01-12 22:55:56 +05:00
/**
* Emitted when the voice channel is empty.
* @event Queue#channelEmpty
*/
2020-01-12 00:01:18 +05:00
/**
* Emitted when the song changes.
* @event Queue#songChanged
* @param {Song} oldSong The old song (playing before)
* @param {Song} newSong The new song (currently playing)
* @param {Boolean} skipped Whether the change is due to the skip() function
*/
module.exports = Queue;