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
|
this.firstMessage = message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current playing track
|
||||||
|
* @type {Track}
|
||||||
|
*/
|
||||||
get playing () {
|
get playing () {
|
||||||
return this.tracks[0]
|
return this.tracks[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calculated volume of the queue
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
get calculatedVolume () {
|
get calculatedVolume () {
|
||||||
return this.filters.bassboost ? this.volume + 50 : this.volume
|
return this.filters.bassboost ? this.volume + 50 : this.volume
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the total time of the queue in milliseconds
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
get totalTime () {
|
get totalTime () {
|
||||||
return this.tracks.length > 0 ? this.tracks.map((t) => t.durationMS).reduce((p, c) => p + c) : 0
|
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 () {
|
get currentStreamTime () {
|
||||||
return this.voiceConnection.dispatcher
|
return this.voiceConnection.dispatcher
|
||||||
? this.voiceConnection.dispatcher.streamTime + this.additionalStreamTime
|
? 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;
|
requestedBy: User;
|
||||||
}
|
}
|
||||||
type Playlist = YTSRPlaylist & CustomPlaylist;
|
type Playlist = YTSRPlaylist & CustomPlaylist;
|
||||||
type PlayerError = 'NotConnected' | 'UnableToJoin' | 'NotPlaying' | 'LiveVideo' | 'ParseError' | 'VideoUnavailable';
|
type PlayerError = 'NotConnected' | 'UnableToJoin' | 'NotPlaying' | 'LiveVideo' | 'ParseError' | 'VideoUnavailable' | 'MusicStarting';
|
||||||
interface PlayerEvents {
|
interface PlayerEvents {
|
||||||
searchResults: [Message, string, Track[]];
|
searchResults: [Message, string, Track[]];
|
||||||
searchInvalidResponse: [Message, string, Track[], string, MessageCollector];
|
searchInvalidResponse: [Message, string, Track[], string, MessageCollector];
|
||||||
|
@ -155,6 +155,7 @@ declare module 'discord-player' {
|
||||||
public playing: Track;
|
public playing: Track;
|
||||||
public calculatedVolume: number;
|
public calculatedVolume: number;
|
||||||
public currentStreamTime: number;
|
public currentStreamTime: number;
|
||||||
|
public totalTime: number;
|
||||||
}
|
}
|
||||||
class Track {
|
class Track {
|
||||||
constructor(videoData: object, user: User, player: Player);
|
constructor(videoData: object, user: User, player: Player);
|
||||||
|
|
Loading…
Reference in a new issue