diff --git a/src/Player.ts b/src/Player.ts index 6fdeaa5..d8cda8a 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -1183,93 +1183,93 @@ export default Player; /** * Emitted when a track starts * @event Player#trackStart - * @param {Discord.Message} message - * @param {Track} track - * @param {Queue} queue + * @param {Discord.Message} message The message + * @param {Track} track The track + * @param {Queue} queue The queue */ /** * Emitted when a playlist is started * @event Player#queueCreate - * @param {Discord.Message} message - * @param {Queue} queue + * @param {Discord.Message} message The message + * @param {Queue} queue The queue */ /** * Emitted when the bot is awaiting search results * @event Player#searchResults - * @param {Discord.Message} message - * @param {string} query - * @param {Track[]} tracks - * @param {Discord.Collector} collector + * @param {Discord.Message} message The message + * @param {string} query The query + * @param {Track[]} tracks The tracks + * @param {Discord.Collector} collector The collector */ /** * Emitted when the user has sent an invalid response for search results * @event Player#searchInvalidResponse - * @param {Discord.Message} message - * @param {string} query - * @param {Track[]} tracks - * @param {string} invalidResponse - * @param {Discord.MessageCollector} collector + * @param {Discord.Message} message The message + * @param {string} query The query + * @param {Track[]} tracks The tracks + * @param {string} invalidResponse The `invalidResponse` string + * @param {Discord.MessageCollector} collector The collector */ /** * Emitted when the bot has stopped awaiting search results (timeout) * @event Player#searchCancel - * @param {Discord.Message} message - * @param {string} query - * @param {Track[]} tracks + * @param {Discord.Message} message The message + * @param {string} query The query + * @param {Track[]} tracks The tracks */ /** * Emitted when the bot can't find related results to the query * @event Player#noResults - * @param {Discord.Message} message - * @param {string} query + * @param {Discord.Message} message The message + * @param {string} query The query */ /** * Emitted when the bot is disconnected from the channel * @event Player#botDisconnect - * @param {Discord.Message} message + * @param {Discord.Message} message The message */ /** * Emitted when the channel of the bot is empty * @event Player#channelEmpty - * @param {Discord.Message} message - * @param {Queue} queue + * @param {Discord.Message} message The message + * @param {Queue} queue The queue */ /** * Emitted when the queue of the server is ended * @event Player#queueEnd - * @param {Discord.Message} message - * @param {Queue} queue + * @param {Discord.Message} message The message + * @param {Queue} queue The queue */ /** * Emitted when a track is added to the queue * @event Player#trackAdd - * @param {Discord.Message} message - * @param {Queue} queue - * @param {Track} track + * @param {Discord.Message} message The message + * @param {Queue} queue The queue + * @param {Track} track The track */ /** * Emitted when a playlist is added to the queue * @event Player#playlistAdd - * @param {Discord.Message} message - * @param {Queue} queue - * @param {Object} playlist + * @param {Discord.Message} message The message + * @param {Queue} queue The queue + * @param {Object} playlist The playlist */ /** * Emitted when an error is triggered * @event Player#error * @param {string} error It can be `NotConnected`, `UnableToJoin`, `NotPlaying`, `ParseError`, `LiveVideo` or `VideoUnavailable`. - * @param {Discord.Message} message + * @param {Discord.Message} message The message */ /** diff --git a/src/types/types.ts b/src/types/types.ts index e1e885a..ee5034e 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -2,6 +2,18 @@ import { downloadOptions } from 'ytdl-core'; import { User } from 'discord.js'; import { Readable, Duplex } from 'stream'; +/** + * @typedef {object} PlayerOptions + * @property {boolean} [leaveOnEnd=false] If it should leave on queue end + * @property {number} [leaveOnEndCooldown=0] Time in ms to wait before executing `leaveOnEnd` + * @property {boolean} [leaveOnStop=false] If it should leave on stop command + * @property {boolean} [leaveOnEmpty=false] If it should leave on empty voice channel + * @property {number} [leaveOnEmptyCooldown=0] Time in ms to wait before executing `leaveOnEmpty` + * @property {boolean} [autoSelfDeaf=false] If it should set the client to `self deaf` mode on joining + * @property {boolean} [enableLive=false] If it should enable live videos support + * @property {YTDLDownloadOptions} [ytdlDownloadOptions={}] The download options passed to `ytdl-core` + * @property {boolean} [useSafeSearch=false] If it should use `safe search` method for youtube searches + */ export interface PlayerOptions { leaveOnEnd?: boolean; leaveOnEndCooldown?: number; @@ -16,8 +28,25 @@ export interface PlayerOptions { export type FiltersName = keyof QueueFilters; -export type TrackSource = 'soundcloud' | 'youtube' | 'arbitrary'; +/** + * @typedef {'soundcloud'|'youtube'|'arbitrary'} TrackSource + */ +export type TrackSource = 'soundcloud'|'youtube'|'arbitrary'; +/** + * @typedef {object} TrackData + * @property {string} title The title + * @property {string} description The description + * @property {string} author The author + * @property {string} url The url + * @property {string} duration The duration + * @property {number} views The view count + * @property {Discord.User} requestedBy The user who requested this track + * @property {boolean} fromPlaylist If this track came from a playlist + * @property {TrackSource} [source] The track source + * @property {string|Readable} [engine] The stream engine + * @property {boolean} [live=false] If this track is livestream instance + */ export interface TrackData { title: string; description: string; @@ -33,6 +62,10 @@ export interface TrackData { live?: boolean; } +/** + * @typedef {object} QueueFilters + * The FFmpeg Filters + */ export type QueueFilters = { bassboost?: boolean; '8D'?: boolean; @@ -64,6 +97,9 @@ export type QueueFilters = { fadein?: boolean; }; +/** + * @typedef {'soundcloud_track'|'soundcloud_playlist'|'spotify_song'|'spotify_album'|'spotify_playlist'|'youtube_video'|'youtube_playlist'|'vimeo'|'facebook'|'reverbnation'|'attachment'|'youtube_search'} QueryType The query type + */ export type QueryType = | 'soundcloud_track' | 'soundcloud_playlist' @@ -78,6 +114,19 @@ export type QueryType = | 'attachment' | 'youtube_search'; +/** + * @typedef {object} ExtractorModelData + * @property {string} title The title + * @property {number} duration The duration in ms + * @property {string} thumbnail The thumbnail url + * @property {string|Readable} engine The audio engine + * @property {number} views The views count of this stream + * @property {string} author The author + * @property {string} description The description + * @property {string} url The url + * @property {string} [version='0.0.0'] The extractor version + * @property {boolean} [important=false] Mark as important + */ export interface ExtractorModelData { title: string; duration: number; @@ -88,14 +137,35 @@ export interface ExtractorModelData { description: string; url: string; version?: string; + important?: boolean; } +/** + * @typedef {object} PlayerProgressbarOptions + * @property {boolean} [timecodes] If it should return progres bar with time codes + * @property {boolean} [queue] if it should return the progress bar of the whole queue + * @property {number} [length] The length of progress bar to build + */ export interface PlayerProgressbarOptions { timecodes?: boolean; queue?: boolean; length?: number; } +/** + * @typedef {object} LyricsData + * @property {string} title The title of the lyrics + * @property {number} id The song id + * @property {string} thumbnail The thumbnail + * @property {string} image The image + * @property {string} url The url + * @property {object} artist The artust info + * @property {string} [artist.name] The name of the artist + * @property {number} [artist.id] The ID of the artist + * @property {string} [artist.url] The profile link of the artist + * @property {string} [artist.image] The artist image url + * @property {string?} lyrics The lyrics + */ export interface LyricsData { title: string; id: number; @@ -111,6 +181,28 @@ export interface LyricsData { lyrics?: string; } +/** + * @typedef {object} PlayerStats + * @property {number} uptime The uptime in ms + * @property {number} connections The number of connections + * @property {number} users The number of users + * @property {number} queues The number of queues + * @property {number} extractors The number of custom extractors registered + * @property {object} versions The versions metadata + * @property {string} [versions.ffmpeg] The ffmpeg version + * @property {string} [versions.node] The node version + * @property {string} [versions.v8] The v8 JavaScript engine version + * @property {object} system The system data + * @property {string} [system.arch] The system arch + * @property {'aix'|'android'|'darwin'|'freebsd'|'linux'|'openbsd'|'sunos'|'win32'|'cygwin'|'netbsd'} [system.platform] The system platform + * @property {number} [system.cpu] The cpu count + * @property {object} [system.memory] The memory info + * @property {string} [system.memory.total] The total memory + * @property {string} [system.memory.usage] The memory usage + * @property {string} [system.memory.rss] The memory usage in RSS + * @property {string} [system.memory.arrayBuffers] The memory usage in ArrayBuffers + * @property {number} [system.uptime] The system uptime + */ export interface PlayerStats { uptime: number; connections: number; @@ -146,6 +238,13 @@ export interface PlayerStats { }; } +/** + * @typedef {object} TimeData + * @property {number} days The time in days + * @property {number} hours The time in hours + * @property {number} minutes The time in minutes + * @property {number} seconds The time in seconds + */ export interface TimeData { days: number; hours: number;