add missing types & docs (#308)
This commit is contained in:
parent
bc2f44520d
commit
cd2ac779d9
2 changed files with 18 additions and 1 deletions
16
src/Queue.js
16
src/Queue.js
|
@ -90,18 +90,34 @@ class Queue extends EventEmitter {
|
|||
this.firstMessage = message
|
||||
}
|
||||
|
||||
/**
|
||||
* The current playing track
|
||||
* @type {Track}
|
||||
*/
|
||||
get playing () {
|
||||
return this.tracks[0]
|
||||
}
|
||||
|
||||
/**
|
||||
* The calculated volume of the queue
|
||||
* @type {number}
|
||||
*/
|
||||
get calculatedVolume () {
|
||||
return this.filters.bassboost ? this.volume + 50 : this.volume
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total time of the queue in milliseconds
|
||||
* @type {number}
|
||||
*/
|
||||
get totalTime () {
|
||||
return this.tracks.length > 0 ? this.tracks.map((t) => t.durationMS).reduce((p, c) => p + c) : 0
|
||||
}
|
||||
|
||||
/**
|
||||
* The current stream time
|
||||
* @type {number}
|
||||
*/
|
||||
get currentStreamTime () {
|
||||
return this.voiceConnection.dispatcher
|
||||
? this.voiceConnection.dispatcher.streamTime + this.additionalStreamTime
|
||||
|
|
3
typings/index.d.ts
vendored
3
typings/index.d.ts
vendored
|
@ -115,7 +115,7 @@ declare module 'discord-player' {
|
|||
requestedBy: User;
|
||||
}
|
||||
type Playlist = YTSRPlaylist & CustomPlaylist;
|
||||
type PlayerError = 'NotConnected' | 'UnableToJoin' | 'NotPlaying' | 'LiveVideo' | 'ParseError' | 'VideoUnavailable';
|
||||
type PlayerError = 'NotConnected' | 'UnableToJoin' | 'NotPlaying' | 'LiveVideo' | 'ParseError' | 'VideoUnavailable' | 'MusicStarting';
|
||||
interface PlayerEvents {
|
||||
searchResults: [Message, string, Track[]];
|
||||
searchInvalidResponse: [Message, string, Track[], string, MessageCollector];
|
||||
|
@ -155,6 +155,7 @@ declare module 'discord-player' {
|
|||
public playing: Track;
|
||||
public calculatedVolume: number;
|
||||
public currentStreamTime: number;
|
||||
public totalTime: number;
|
||||
}
|
||||
class Track {
|
||||
constructor(videoData: object, user: User, player: Player);
|
||||
|
|
Loading…
Reference in a new issue