distube 3.0.0-beta.35 → 3.0.0-beta.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/DisTube.d.ts +78 -57
- package/dist/DisTube.d.ts.map +1 -1
- package/dist/DisTube.js +87 -87
- package/dist/DisTube.js.map +1 -1
- package/dist/constant.d.ts +43 -10
- package/dist/constant.d.ts.map +1 -1
- package/dist/constant.js +45 -11
- package/dist/constant.js.map +1 -1
- package/dist/core/DisTubeBase.d.ts +7 -13
- package/dist/core/DisTubeBase.d.ts.map +1 -1
- package/dist/core/DisTubeBase.js +4 -9
- package/dist/core/DisTubeBase.js.map +1 -1
- package/dist/core/DisTubeHandler.d.ts +9 -4
- package/dist/core/DisTubeHandler.d.ts.map +1 -1
- package/dist/core/DisTubeHandler.js +56 -10
- package/dist/core/DisTubeHandler.js.map +1 -1
- package/dist/core/DisTubeOptions.d.ts +0 -18
- package/dist/core/DisTubeOptions.d.ts.map +1 -1
- package/dist/core/DisTubeOptions.js +4 -1
- package/dist/core/DisTubeOptions.js.map +1 -1
- package/dist/core/DisTubeStream.d.ts +5 -2
- package/dist/core/DisTubeStream.d.ts.map +1 -1
- package/dist/core/DisTubeStream.js +23 -21
- package/dist/core/DisTubeStream.js.map +1 -1
- package/dist/core/manager/BaseManager.d.ts +2 -3
- package/dist/core/manager/BaseManager.d.ts.map +1 -1
- package/dist/core/manager/BaseManager.js +3 -3
- package/dist/core/manager/BaseManager.js.map +1 -1
- package/dist/core/manager/QueueManager.d.ts +2 -2
- package/dist/core/manager/QueueManager.d.ts.map +1 -1
- package/dist/core/manager/QueueManager.js +25 -22
- package/dist/core/manager/QueueManager.js.map +1 -1
- package/dist/core/voice/DisTubeVoice.d.ts +15 -15
- package/dist/core/voice/DisTubeVoice.d.ts.map +1 -1
- package/dist/core/voice/DisTubeVoice.js +27 -16
- package/dist/core/voice/DisTubeVoice.js.map +1 -1
- package/dist/core/voice/DisTubeVoiceManager.js +1 -1
- package/dist/core/voice/DisTubeVoiceManager.js.map +1 -1
- package/dist/plugin/http.js +2 -2
- package/dist/plugin/http.js.map +1 -1
- package/dist/plugin/https.js +3 -3
- package/dist/plugin/https.js.map +1 -1
- package/dist/plugin/youtube-dl.js +3 -3
- package/dist/plugin/youtube-dl.js.map +1 -1
- package/dist/struct/CustomPlugin.d.ts +17 -14
- package/dist/struct/CustomPlugin.d.ts.map +1 -1
- package/dist/struct/CustomPlugin.js +16 -16
- package/dist/struct/CustomPlugin.js.map +1 -1
- package/dist/struct/DisTubeError.d.ts +12 -3
- package/dist/struct/DisTubeError.d.ts.map +1 -1
- package/dist/struct/DisTubeError.js +11 -12
- package/dist/struct/DisTubeError.js.map +1 -1
- package/dist/struct/ExtractorPlugin.d.ts +16 -8
- package/dist/struct/ExtractorPlugin.d.ts.map +1 -1
- package/dist/struct/ExtractorPlugin.js +13 -12
- package/dist/struct/ExtractorPlugin.js.map +1 -1
- package/dist/struct/Playlist.d.ts +2 -3
- package/dist/struct/Playlist.d.ts.map +1 -1
- package/dist/struct/Playlist.js +9 -6
- package/dist/struct/Playlist.js.map +1 -1
- package/dist/struct/Plugin.d.ts +62 -9
- package/dist/struct/Plugin.d.ts.map +1 -1
- package/dist/struct/Plugin.js +73 -14
- package/dist/struct/Plugin.js.map +1 -1
- package/dist/struct/Queue.d.ts +17 -15
- package/dist/struct/Queue.d.ts.map +1 -1
- package/dist/struct/Queue.js +31 -16
- package/dist/struct/Queue.js.map +1 -1
- package/dist/struct/SearchResult.js +2 -2
- package/dist/struct/SearchResult.js.map +1 -1
- package/dist/struct/Song.d.ts +6 -8
- package/dist/struct/Song.d.ts.map +1 -1
- package/dist/struct/Song.js +17 -15
- package/dist/struct/Song.js.map +1 -1
- package/dist/struct/__mocks__/Queue.d.ts +12 -0
- package/dist/struct/__mocks__/Queue.d.ts.map +1 -0
- package/dist/struct/__mocks__/Queue.js +22 -0
- package/dist/struct/__mocks__/Queue.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type.d.ts +76 -20
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +16 -7
- package/dist/util.js.map +1 -1
- package/package.json +30 -28
package/dist/DisTube.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisTube.js","sourceRoot":"","sources":["../src/DisTube.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiC;AACjC,yDAAiC;AACjC,mCAAsC;AACtC,iCAAkE;AAClE,wBAiBW;AA2BX;;;GAGG;AACH,MAAa,OAAQ,SAAQ,qBAAY;IACvC;;;;;;;;;;;;OAYG;IACH,YAAY,MAAc,EAAE,MAAsB,EAAE;QAClD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,mBAAgB,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,eAAY,CAAC,cAAc,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1G;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,mBAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7B;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,sBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5C;;;WAGG;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,UAAO,CAAC,GAAG,CAAC,CAAC;QAChC;;;;WAIG;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAc,CAAC,IAAI,CAAC,CAAC;QACxC;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,eAAY,CAAC,IAAI,CAAC,CAAC;QACrC;;;WAGG;QACH,IAAI,CAAC,OAAO,GAAG,iBAAc,CAAC;QAC9B,IAAI,OAAO,IAAI,CAAC,OAAO,C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C;YACrB,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CACV,2IAA2I,CAC5I,CAAC;SACH;IACH,CAAC;CAEF;AAvmBD,0BAumBC;AAED,kBAAe,OAAO,CAAC;AAEvB;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG","sourcesContent":["import ytpl from \"@distube/ytpl\";\nimport ytsr from \"@distube/ytsr\";\nimport { EventEmitter } from \"events\";\nimport { checkIntents, isURL, isVoiceChannelEmpty } from \"./util\";\nimport {\n DisTubeError,\n DisTubeHandler,\n DisTubeVoiceManager,\n HTTPPlugin,\n HTTPSPlugin,\n Options,\n Playlist,\n Queue,\n QueueManager,\n SearchResult,\n YouTubeDLPlugin,\n defaultFilters,\n isClientInstance,\n isMessageInstance,\n isSupportedVoiceChannel,\n isTextChannelInstance,\n} from \".\";\nimport type { Client, GuildMember, Message, StageChannel, TextChannel, VoiceChannel } from \"discord.js\";\nimport type { CustomPlugin, DisTubeOptions, ExtractorPlugin, Filters, GuildIDResolvable, Song } from \".\";\n\nexport declare interface DisTube {\n handler: DisTubeHandler;\n options: Options;\n client: Client;\n queues: QueueManager;\n voices: DisTubeVoiceManager;\n extractorPlugins: ExtractorPlugin[];\n customPlugins: CustomPlugin[];\n filters: Filters;\n on(event: \"addList\", listener: (queue: Queue, playlist: Playlist) => void): this;\n on(event: \"addSong\" | \"playSong\" | \"finishSong\", listener: (queue: Queue, song: Song) => void): this;\n on(\n event: \"empty\" | \"finish\" | \"initQueue\" | \"noRelated\" | \"disconnect\" | \"deleteQueue\",\n listener: (queue: Queue) => void,\n ): this;\n on(event: \"error\", listener: (channel: TextChannel, error: Error) => void): this;\n on(event: \"searchNoResult\" | \"searchCancel\", listener: (message: Message, query: string) => void): this;\n on(event: \"searchResult\", listener: (message: Message, results: SearchResult[], query: string) => void): this;\n on(\n event: \"searchInvalidAnswer\" | \"searchDone\",\n listener: (message: Message, answer: Message, query: string) => void,\n ): this;\n}\n/**\n * DisTube class\n * @extends EventEmitter\n */\nexport class DisTube extends EventEmitter {\n /**\n * Create a new DisTube class.\n * @param {Discord.Client} client JS client\n * @param {DisTubeOptions} [otp] Custom DisTube options\n * @example\n * const Discord = require('discord.js'),\n * DisTube = require('distube'),\n * client = new Discord.Client();\n * // Create a new DisTube\n * const distube = new DisTube.default(client, { searchSongs: 10 });\n * // client.DisTube = distube // make it access easily\n * client.login(\"Your Discord Bot Token\")\n */\n constructor(client: Client, otp: DisTubeOptions = {}) {\n super();\n this.setMaxListeners(1);\n if (!isClientInstance(client)) throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Client\", client, \"client\");\n /**\n * Discord.JS client\n * @type {Discord.Client}\n */\n this.client = client;\n checkIntents(client.options);\n /**\n * Voice connections manager\n * @type {DisTubeVoiceManager}\n */\n this.voices = new DisTubeVoiceManager(this);\n /**\n * DisTube options\n * @type {DisTubeOptions}\n */\n this.options = new Options(otp);\n /**\n * DisTube's Handler\n * @type {DisTubeHandler}\n * @private\n */\n this.handler = new DisTubeHandler(this);\n /**\n * Queues manager\n * @type {QueueManager}\n */\n this.queues = new QueueManager(this);\n /**\n * DisTube filters\n * @type {Filters}\n */\n this.filters = defaultFilters;\n if (typeof this.options.customFilters === \"object\") Object.assign(this.filters, this.options.customFilters);\n if (this.options.leaveOnEmpty) {\n client.on(\"voiceStateUpdate\", oldState => {\n if (!oldState?.channel) return;\n const queue = this.getQueue(oldState);\n if (!queue) {\n if (isVoiceChannelEmpty(oldState)) {\n setTimeout(() => {\n const guildID = oldState.guild.id;\n if (!this.getQueue(oldState) && isVoiceChannelEmpty(oldState)) this.voices.leave(guildID);\n }, this.options.emptyCooldown * 1e3).unref();\n }\n return;\n }\n if (queue.emptyTimeout) {\n clearTimeout(queue.emptyTimeout);\n delete queue.emptyTimeout;\n }\n if (isVoiceChannelEmpty(oldState)) {\n queue.emptyTimeout = setTimeout(() => {\n if (isVoiceChannelEmpty(oldState)) {\n queue.voice.leave();\n this.emit(\"empty\", queue);\n queue.delete();\n }\n }, this.options.emptyCooldown * 1e3).unref();\n }\n });\n }\n // Default plugin\n this.options.plugins.push(new HTTPPlugin(), new HTTPSPlugin());\n if (this.options.youtubeDL) this.options.plugins.push(new YouTubeDLPlugin(this.options.updateYouTubeDL));\n this.options.plugins.map(p => p.init(this));\n /**\n * Extractor Plugins\n * @type {ExtractorPlugin[]}\n * @private\n */\n this.extractorPlugins = this.options.plugins.filter((p): p is ExtractorPlugin => p.type === \"extractor\");\n /**\n * Custom Plugins\n * @type {CustomPlugin[]}\n * @private\n */\n this.customPlugins = this.options.plugins.filter((p): p is CustomPlugin => p.type === \"custom\");\n }\n\n /**\n * Shorthand method for {@link DisTube#playVoiceChannel}\n * @returns {Promise<void>}\n * @param {Discord.Message} message A message from guild channel\n * @param {string|Song|SearchResult|Playlist} song YouTube url | Search string | {@link Song} | {@link SearchResult} | {@link Playlist}\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly\n * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue (after the playing song if exists)\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"play\")\n * distube.play(message, args.join(\" \"));\n * });\n */\n async play(\n message: Message,\n song: string | Song | SearchResult | Playlist,\n options: { skip?: boolean; unshift?: boolean } = {},\n ): Promise<void> {\n if (!song) return;\n if (!isMessageInstance(message)) throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Message\", message, \"message\");\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n }\n const textChannel = message.channel as TextChannel;\n const { skip, unshift } = Object.assign({ skip: false, unshift: false }, options);\n const member = message.member as GuildMember;\n const voiceChannel = member.voice.channel;\n if (!voiceChannel) throw new DisTubeError(\"NOT_IN_VOICE\");\n await this.playVoiceChannel(voiceChannel, song, {\n member,\n textChannel,\n skip,\n message,\n unshift,\n });\n }\n\n /**\n * Play / add a song or playlist from url. Search and play a song if it is not a valid url.\n * Emit {@link DisTube#addList}, {@link DisTube#addSong} or {@link DisTube#playSong} after executing\n * @returns {Promise<void>}\n * @param {Discord.VoiceChannel|Discord.StageChannel} voiceChannel The voice channel will be joined\n * @param {string|Song|SearchResult|Playlist} song YouTube url | Search string | {@link Song} | {@link SearchResult} | {@link Playlist}\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly\n * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue (after the playing song if exists)\n * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)\n * @param {Discord.TextChannel} [options.textChannel] Default {@link Queue#textChannel} (if the queue wasn't created)\n * @param {Discord.Message} [options.message] Called message (For built-in search events. If this is a {@link https://developer.mozilla.org/en-US/docs/Glossary/Falsy|falsy value}, it will play the first result instead)\n */\n async playVoiceChannel(\n voiceChannel: VoiceChannel | StageChannel,\n song: string | Song | SearchResult | Playlist | null,\n options: {\n skip?: boolean;\n unshift?: boolean;\n member?: GuildMember;\n textChannel?: TextChannel;\n message?: Message;\n } = {},\n ): Promise<void> {\n if (!isSupportedVoiceChannel(voiceChannel)) throw new DisTubeError(\"NOT_SUPPORTED_VOICE\");\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n }\n const { textChannel, member, skip, message, unshift } = Object.assign(\n {\n member: voiceChannel.guild.me,\n skip: false,\n unshift: false,\n },\n options,\n );\n if (message && !isMessageInstance(message)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"Discord.Message\", \"a falsy value\"], message, \"options.message\");\n }\n try {\n if (typeof song === \"string\") {\n for (const plugin of this.customPlugins) {\n if (await plugin.validate(song)) {\n return plugin.play(voiceChannel, song, member, textChannel as TextChannel, skip, unshift);\n }\n }\n }\n let queue = this.getQueue(voiceChannel);\n const queuing = queue && !queue.taskQueue.hasResolveTask;\n if (queuing) await queue?.taskQueue.queuing(true);\n try {\n if (song instanceof SearchResult && song.type === \"playlist\") song = song.url;\n if (typeof song === \"string\" && ytpl.validateID(song)) song = await this.handler.resolvePlaylist(member, song);\n if (typeof song === \"string\" && !isURL(song)) {\n if (!message) song = (await this.search(song, { limit: 1 }))[0];\n else song = await this.handler.searchSong(message, song);\n }\n song = await this.handler.resolveSong(member, song);\n if (!song) return;\n if (song instanceof Playlist) {\n await this.handler.handlePlaylist(voiceChannel, song, textChannel, skip, unshift);\n } else if (!this.options.nsfw && (song as Song).age_restricted && !textChannel?.nsfw) {\n throw new DisTubeError(\"NON_NSFW\");\n } else {\n queue = this.getQueue(voiceChannel);\n if (queue) {\n queue.addToQueue(song as Song, skip || unshift ? 1 : -1);\n if (skip) queue.skip();\n else this.emit(\"addSong\", queue, song);\n } else {\n const newQueue = await this.handler.createQueue(voiceChannel, song as Song, textChannel);\n if (newQueue instanceof Queue) {\n if (this.options.emitAddSongWhenCreatingQueue) this.emit(\"addSong\", newQueue, song);\n this.emit(\"playSong\", newQueue, song);\n }\n }\n }\n } finally {\n if (queuing) queue?.taskQueue.resolve();\n }\n } catch (e: any) {\n if (!(e instanceof DisTubeError)) {\n try {\n e.name = \"PlayError\";\n e.message = `${(song as Song)?.url || song}\\n${e.message}`;\n } catch {}\n }\n this.emitError(e, textChannel);\n }\n }\n\n /**\n * Play or add array of video urls.\n * {@link DisTube#event:playSong} or {@link DisTube#event:addList} will be emitted\n * with `playlist`'s properties include `properties` parameter's properties such as\n * `user`, `songs`, `duration`, `formattedDuration`, `thumbnail` like {@link Playlist}\n * @returns {Promise<void>}\n * @param {Discord.Message} message A message from guild channel\n * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult\n * @param {Object} [properties={}] Additional properties such as `name`\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly\n * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue (after the playing song if exists)\n * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel\n * @example\n * let songs = [\"https://www.youtube.com/watch?v=xxx\", \"https://www.youtube.com/watch?v=yyy\"];\n * distube.playCustomPlaylist(message, songs, { name: \"My playlist name\" });\n * // Fetching custom playlist sequentially (reduce lag for low specs)\n * distube.playCustomPlaylist(message, songs, { name: \"My playlist name\" }, false, false);\n */\n async playCustomPlaylist(\n message: Message,\n songs: Array<string | Song | SearchResult>,\n properties: any = {},\n options: { skip?: boolean; unshift?: boolean; parallel?: boolean } = {},\n ): Promise<void> {\n try {\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n }\n const { skip, unshift, parallel } = Object.assign(\n {\n skip: false,\n unshift: false,\n parallel: true,\n },\n options,\n );\n const queue = this.getQueue(message);\n const queuing = queue && !queue.taskQueue.hasResolveTask;\n if (queuing) await queue?.taskQueue.queuing(true);\n try {\n const playlist = await this.handler.createCustomPlaylist(message, songs, properties, parallel);\n await this.handler.handlePlaylist(message, playlist, message.channel as TextChannel, skip, unshift);\n } finally {\n if (queuing) queue?.taskQueue.resolve();\n }\n } catch (e: any) {\n this.emitError(e, message.channel as TextChannel);\n }\n }\n\n /**\n * Search for a song.\n * You can customize how user answers instead of send a number.\n * Then use {@link DisTube#play} or {@link DisTube#playSkip} to play it.\n * @param {string} string The string search for\n * @param {Object} options Search options\n * @param {number} [options.limit=10] Limit the results\n * @param {'video'|'playlist'} [options.type='video'] Type of results (`video` or `playlist`).\n * @param {boolean} [options.safeSearch=false] Whether or not use safe search (YouTube restricted mode)\n * @throws {Error}\n * @returns {Promise<Array<SearchResult>>} Array of results\n */\n async search(\n string: string,\n options: { type?: \"video\" | \"playlist\"; limit?: number; safeSearch?: boolean; retried?: boolean } = {},\n ): Promise<Array<SearchResult>> {\n const opts = Object.assign({ type: \"video\", limit: 10, safeSearch: false }, options);\n if (typeof opts.type !== \"string\" || ![\"video\", \"playlist\"].includes(opts.type)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"video\", \"playlist\"], opts.type, \"options.type\");\n }\n if (typeof opts.limit !== \"number\") throw new DisTubeError(\"INVALID_TYPE\", \"number\", opts.limit, \"options.limit\");\n if (opts.limit < 1) throw new DisTubeError(\"NUMBER_COMPARE\", \"option.limit\", \"bigger or equal to\", 1);\n if (typeof opts.safeSearch !== \"boolean\") {\n throw new DisTubeError(\"INVALID_TYPE\", \"boolean\", opts.safeSearch, \"options.safeSearch\");\n }\n\n try {\n const search = await ytsr(string, opts);\n const results = search.items.map(i => new SearchResult(i));\n if (results.length === 0) throw new DisTubeError(\"NO_RESULT\");\n return results;\n } catch (e) {\n if (options.retried) throw e;\n options.retried = true;\n return this.search(string, options);\n }\n }\n\n /**\n * Get the guild queue\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue?}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"queue\") {\n * const queue = distube.getQueue(message);\n * message.channel.send('Current queue:\\n' + queue.songs.map((song, id) =>\n * `**${id+1}**. [${song.name}](${song.url}) - \\`${song.formattedDuration}\\``\n * ).join(\"\\n\"));\n * }\n * });\n */\n getQueue(queue: GuildIDResolvable): Queue | undefined {\n return this.queues.get(queue);\n }\n\n /**\n * Pause the guild stream\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n pause(queue: GuildIDResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.pause();\n }\n\n /**\n * Resume the guild stream\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n resume(queue: GuildIDResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.resume();\n }\n\n /**\n * Stop the guild stream\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<void>}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"stop\") {\n * distube.stop(message);\n * message.channel.send(\"Stopped the queue!\");\n * }\n * });\n */\n stop(queue: GuildIDResolvable): Promise<void> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.stop();\n }\n\n /**\n * Set the guild stream's volume\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} percent The percentage of volume you want to set\n * @returns {Queue} The guild queue\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"volume\")\n * distube.setVolume(message, Number(args[0]));\n * });\n */\n setVolume(queue: GuildIDResolvable, percent: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setVolume(percent);\n }\n\n /**\n * Skip the playing song\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"skip\")\n * distube.skip(message);\n * });\n */\n skip(queue: GuildIDResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.skip();\n }\n\n /**\n * Play the previous song\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"previous\")\n * distube.previous(message);\n * });\n */\n previous(queue: GuildIDResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.previous();\n }\n\n /**\n * Shuffle the guild queue songs\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Queue>} The guild queue\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"shuffle\")\n * distube.shuffle(message);\n * });\n */\n shuffle(queue: GuildIDResolvable): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.shuffle();\n }\n\n /**\n * Jump to the song number in the queue.\n * The next one is 1, 2,...\n * The previous one is -1, -2,...\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} num The song number to play\n * @returns {Promise<Queue>} The guild queue\n * @throws {Error} if `num` is invalid number (0 < num < {@link Queue#songs}.length)\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"jump\")\n * distube.jump(message, parseInt(args[0]))\n * .catch(err => message.channel.send(\"Invalid song number.\"));\n * });\n */\n jump(queue: GuildIDResolvable, num: number): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.jump(num);\n }\n\n /**\n * Set the repeat mode of the guild queue.\n * Turn off if repeat mode is the same value as new mode.\n * Toggle mode `(0 -> 1 -> 2 -> 0...)`: `mode` is `undefined`\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number?} [mode] The repeat modes `(0: disabled, 1: Repeat a song, 2: Repeat all the queue)`\n * @returns {number} The new repeat mode\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"repeat\") {\n * let mode = distube.setRepeatMode(message, parseInt(args[0]));\n * mode = mode ? mode == 2 ? \"Repeat queue\" : \"Repeat song\" : \"Off\";\n * message.channel.send(\"Set repeat mode to `\" + mode + \"`\");\n * }\n * });\n */\n setRepeatMode(queue: GuildIDResolvable, mode?: number): number {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setRepeatMode(mode);\n }\n\n /**\n * Toggle autoplay mode\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {boolean} Autoplay mode state\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"autoplay\") {\n * let mode = distube.toggleAutoplay(message);\n * message.channel.send(\"Set autoplay mode to `\" + (mode ? \"On\" : \"Off\") + \"`\");\n * }\n * });\n */\n toggleAutoplay(queue: GuildIDResolvable): boolean {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n q.autoplay = !q.autoplay;\n return q.autoplay;\n }\n\n /**\n * Add related song to the queue\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The guild queue\n */\n addRelatedSong(queue: GuildIDResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.addRelatedSong();\n }\n\n /**\n * Enable or disable filter(s) of the queue.\n * Available filters: {@link Filters}\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {string|false} filter A filter name, `false` to clear all the filters\n * @param {boolean} [force=false] Force enable the input filter(s) even if it's enabled\n * @returns {Array<string>} Enabled filters.\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if ([`3d`, `bassboost`, `echo`, `karaoke`, `nightcore`, `vaporwave`].includes(command)) {\n * let filter = distube.setFilter(message, command);\n * message.channel.send(\"Current queue filter: \" + (filter.join(\", \") || \"Off\"));\n * }\n * });\n */\n setFilter(queue: GuildIDResolvable, filter: string | false, force = false): Array<string> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setFilter(filter, force);\n }\n\n /**\n * Set the playing time to another position\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} time Time in seconds\n * @returns {Queue} Seeked queue\n * @example\n * client.on('message', message => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command = 'seek')\n * distube.seek(message, Number(args[0]));\n * });\n */\n seek(queue: GuildIDResolvable, time: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.seek(time);\n }\n\n /* eslint-disable no-console */\n /**\n * Emit error event\n * @param {Error} error error\n * @param {Discord.TextChannel?} channel Text channel where the error is encountered.\n * @private\n */\n emitError(error: Error, channel?: TextChannel): void {\n if (!channel || !isTextChannelInstance(channel)) {\n console.error(error);\n console.warn(\"This is logged because <Queue>.textChannel is undefined\");\n } else if (this.listeners(\"error\").length) {\n this.emit(\"error\", channel, error);\n } else {\n console.error(error);\n console.warn(\"Unhandled 'error' event.\");\n console.warn(\n \"See: https://distube.js.org/#/docs/DisTube/beta/class/DisTube?scrollTo=e-error and https://nodejs.org/api/events.html#events_error_events\",\n );\n }\n }\n /* eslint-enable no-console */\n}\n\nexport default DisTube;\n\n/**\n * Emitted after DisTube add a new playlist to the playing {@link Queue}\n *\n * @event DisTube#addList\n * @param {Queue} queue The guild queue\n * @param {Playlist} playlist Playlist info\n * @example\n * distube.on(\"addList\", (queue, playlist) => queue.textChannel.send(\n * `Added \\`${playlist.name}\\` playlist (${playlist.songs.length} songs) to the queue!`\n * ));\n */\n\n/**\n * Emitted after DisTube add a new song to the playing {@link Queue}\n *\n * @event DisTube#addSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Added song\n * @example\n * distube.on(\"addSong\", (queue, song) => queue.textChannel.send(\n * `Added ${song.name} - \\`${song.formattedDuration}\\` to the queue by ${song.user}.`\n * ));\n */\n\n/**\n * Emitted when there is no user in the voice channel, {@link DisTubeOptions}.leaveOnEmpty is `true` and there is a playing queue.\n * If there is no playing queue (stopped and {@link DisTubeOptions}.leaveOnStop is `false`), it will leave the channel without emitting this event.\n *\n * @event DisTube#empty\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"empty\", queue => queue.textChannel.send(\"Channel is empty. Leaving the channel\"))\n */\n\n/**\n * Emitted when {@link DisTube} encounters an error.\n *\n * @event DisTube#error\n * @param {Discord.TextChannel} channel Text channel where the error is encountered.\n * @param {Error} error The error encountered\n * @example\n * distube.on(\"error\", (channel, error) => channel.send(\n * \"An error encountered: \" + error\n * ));\n */\n\n/**\n * Emitted when there is no more song in the queue and {@link Queue#autoplay} is `false`.\n * DisTube will leave voice channel if {@link DisTubeOptions}.leaveOnFinish is `true`\n *\n * @event DisTube#finish\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"finish\", queue => queue.textChannel.send(\"No more song in queue\"));\n */\n\n/**\n * Emitted when DisTube initialize a queue to change queue default properties.\n *\n * @event DisTube#initQueue\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"initQueue\", queue => {\n * queue.autoplay = false;\n * queue.volume = 100;\n * });\n */\n\n/**\n * Emitted when {@link Queue#autoplay} is `true`, the {@link Queue#songs} is empty and\n * DisTube cannot find related songs to play\n *\n * @event DisTube#noRelated\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"noRelated\", queue => queue.textChannel.send(\"Can't find related video to play.\"));\n */\n\n/**\n * Emitted when DisTube play a song.\n * If {@link DisTubeOptions}.emitNewSongOnly is `true`, event is not emitted when looping a song or next song is the previous one\n *\n * @event DisTube#playSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Playing song\n * @example\n * const status = (queue) => `Volume: \\`${queue.volume}%\\` | Loop: \\`${queue.repeatMode ? queue.repeatMode == 2 ? \"Server Queue\" : \"This Song\" : \"Off\"}\\` | Autoplay: \\`${queue.autoplay ? \"On\" : \"Off\"}\\``;\n * distube.on(\"playSong\", (queue, song) => queue.textChannel.send(\n * `Playing \\`${song.name}\\` - \\`${song.formattedDuration}\\`\\nRequested by: ${song.user}\\n${status(queue)}`\n * ));\n */\n\n/**\n * Emitted when DisTube cannot find any results for the query\n *\n * @event DisTube#searchNoResult\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * distube.on(\"searchNoResult\", (message, query) => message.channel.send(`No result found for ${query}!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0\n * and song param of {@link DisTube#play|play()} is invalid url.\n * DisTube will wait for user's next message to choose song manually.\n * <info>{@link https://support.google.com/youtube/answer/7354993|Safe search} is enabled\n * if {@link DisTubeOptions}.nsfw is disabled and the message's channel is not a nsfw channel.</info>\n *\n * @event DisTube#searchResult\n * @param {Discord.Message} message The user message called play method\n * @param {Array<SearchResult>} results Searched results\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchResult\", (message, results) => {\n * message.channel.send(`**Choose an option from below**\\n${results.map((song, i) => `**${i + 1}**. ${song.name} - \\`${song.formattedDuration}\\``).join(\"\\n\")}\\n*Enter anything else or wait 60 seconds to cancel*`);\n * });\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0\n * and the search canceled due to {@link DisTubeOptions|DisTubeOptions.searchTimeout}\n *\n * @event DisTube#searchCancel\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchCancel\", (message) => message.channel.send(`Searching canceled`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0\n * and the search canceled due to user's next message is not a number or out of results range\n *\n * @event DisTube#searchInvalidAnswer\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchInvalidAnswer\", (message) => message.channel.send(`You answered an invalid number!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0\n * and after the user chose a search result to play\n *\n * @event DisTube#searchDone\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n */\n\n/**\n * Emitted when the bot is disconnected to the voice channel\n *\n * @event DisTube#disconnect\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when a {@link Queue} is deleted with any reasons.\n *\n * @event DisTube#deleteQueue\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when DisTube finished a song\n *\n * @event DisTube#finishSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Finished song\n */\n"]}
|
|
1
|
+
{"version":3,"file":"DisTube.js","sourceRoot":"","sources":["../src/DisTube.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiC;AACjC,yDAAiC;AACjC,i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;;;;;;;;;GAkBG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG","sourcesContent":["import ytpl from \"@distube/ytpl\";\nimport ytsr from \"@distube/ytsr\";\nimport { checkIntents, isURL } from \"./util\";\nimport { TypedEmitter } from \"tiny-typed-emitter\";\nimport {\n DisTubeError,\n DisTubeHandler,\n DisTubeVoiceManager,\n HTTPPlugin,\n HTTPSPlugin,\n Options,\n Playlist,\n Queue,\n QueueManager,\n SearchResult,\n YouTubeDLPlugin,\n defaultFilters,\n isClientInstance,\n isMessageInstance,\n isSupportedVoiceChannel,\n isTextChannelInstance,\n} from \".\";\nimport type { Client, GuildMember, Message, StageChannel, TextChannel, VoiceChannel } from \"discord.js\";\nimport type { CustomPlugin, DisTubeEvents, DisTubeOptions, ExtractorPlugin, Filters, GuildIDResolvable, Song } from \".\";\n\n/**\n * DisTube class\n * @extends EventEmitter\n */\nexport class DisTube extends TypedEmitter<DisTubeEvents> {\n handler: DisTubeHandler;\n options: Options;\n client: Client;\n queues: QueueManager;\n voices: DisTubeVoiceManager;\n extractorPlugins: ExtractorPlugin[];\n customPlugins: CustomPlugin[];\n filters: Filters;\n /**\n * Create a new DisTube class.\n * @param {Discord.Client} client Discord.JS client\n * @param {DisTubeOptions} [otp] Custom DisTube options\n * @example\n * const Discord = require('discord.js'),\n * DisTube = require('distube'),\n * client = new Discord.Client();\n * // Create a new DisTube\n * const distube = new DisTube.default(client, { searchSongs: 10 });\n * // client.DisTube = distube // make it access easily\n * client.login(\"Your Discord Bot Token\")\n */\n constructor(client: Client, otp: DisTubeOptions = {}) {\n super();\n this.setMaxListeners(1);\n if (!isClientInstance(client)) throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Client\", client, \"client\");\n /**\n * Discord.JS client\n * @type {Discord.Client}\n */\n this.client = client;\n checkIntents(client.options);\n /**\n * DisTube options\n * @type {DisTubeOptions}\n */\n this.options = new Options(otp);\n /**\n * Voice connections manager\n * @type {DisTubeVoiceManager}\n */\n this.voices = new DisTubeVoiceManager(this);\n /**\n * DisTube's Handler\n * @type {DisTubeHandler}\n * @private\n */\n this.handler = new DisTubeHandler(this);\n /**\n * Queues manager\n * @type {QueueManager}\n */\n this.queues = new QueueManager(this);\n /**\n * DisTube filters\n * @type {Filters}\n */\n this.filters = defaultFilters;\n Object.assign(this.filters, this.options.customFilters);\n // Default plugin\n this.options.plugins.push(new HTTPPlugin(), new HTTPSPlugin());\n if (this.options.youtubeDL) this.options.plugins.push(new YouTubeDLPlugin(this.options.updateYouTubeDL));\n this.options.plugins.map(p => p.init(this));\n /**\n * Extractor Plugins\n * @type {ExtractorPlugin[]}\n * @private\n */\n this.extractorPlugins = this.options.plugins.filter((p): p is ExtractorPlugin => p.type === \"extractor\");\n /**\n * Custom Plugins\n * @type {CustomPlugin[]}\n * @private\n */\n this.customPlugins = this.options.plugins.filter((p): p is CustomPlugin => p.type === \"custom\");\n }\n\n /**\n * Shorthand method for {@link DisTube#playVoiceChannel}\n * @returns {Promise<void>}\n * @param {Discord.Message} message A message from guild channel\n * @param {string|Song|SearchResult|Playlist} song URL | Search string |\n * {@link Song} | {@link SearchResult} | {@link Playlist}\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly\n * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue\n * (after the playing song if exists)\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"play\")\n * distube.play(message, args.join(\" \"));\n * });\n */\n async play(\n message: Message,\n song: string | Song | SearchResult | Playlist,\n options: { skip?: boolean; unshift?: boolean } = {},\n ): Promise<void> {\n if (!song) return;\n if (!isMessageInstance(message)) throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Message\", message, \"message\");\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n }\n const textChannel = message.channel as TextChannel;\n const { skip, unshift } = Object.assign({ skip: false, unshift: false }, options);\n const member = message.member as GuildMember;\n const voiceChannel = member.voice.channel;\n if (!voiceChannel) throw new DisTubeError(\"NOT_IN_VOICE\");\n await this.playVoiceChannel(voiceChannel, song, {\n member,\n textChannel,\n skip,\n message,\n unshift,\n });\n }\n\n /**\n * Play / add a song or playlist from url. Search and play a song if it is not a valid url.\n * Emit {@link DisTube#addList}, {@link DisTube#addSong} or {@link DisTube#playSong} after executing\n * @returns {Promise<void>}\n * @param {Discord.VoiceChannel|Discord.StageChannel} voiceChannel The voice channel will be joined\n * @param {string|Song|SearchResult|Playlist} song URL | Search string |\n * {@link Song} | {@link SearchResult} | {@link Playlist}\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly\n * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue\n * (after the playing song if exists)\n * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)\n * @param {Discord.TextChannel} [options.textChannel] Default {@link Queue#textChannel} (if the queue wasn't created)\n * @param {Discord.Message} [options.message] Called message (For built-in search events. If this is a {@link https://developer.mozilla.org/en-US/docs/Glossary/Falsy|falsy value}, it will play the first result instead)\n */\n async playVoiceChannel(\n voiceChannel: VoiceChannel | StageChannel,\n song: string | Song | SearchResult | Playlist | null,\n options: {\n skip?: boolean;\n unshift?: boolean;\n member?: GuildMember;\n textChannel?: TextChannel;\n message?: Message;\n } = {},\n ): Promise<void> {\n if (!isSupportedVoiceChannel(voiceChannel)) throw new DisTubeError(\"NOT_SUPPORTED_VOICE\");\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n }\n const { textChannel, member, skip, message, unshift } = Object.assign(\n {\n member: voiceChannel.guild.me,\n skip: false,\n unshift: false,\n },\n options,\n );\n if (message && !isMessageInstance(message)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"Discord.Message\", \"a falsy value\"], message, \"options.message\");\n }\n try {\n if (typeof song === \"string\") {\n for (const plugin of this.customPlugins) {\n if (await plugin.validate(song)) {\n return plugin.play(voiceChannel, song, member, textChannel as TextChannel, skip, unshift);\n }\n }\n }\n let queue = this.getQueue(voiceChannel);\n const queuing = queue && !queue.taskQueue.hasResolveTask;\n if (queuing) await queue?.taskQueue.queuing(true);\n try {\n if (song instanceof SearchResult && song.type === \"playlist\") song = song.url;\n if (typeof song === \"string\" && ytpl.validateID(song)) song = await this.handler.resolvePlaylist(member, song);\n if (typeof song === \"string\" && !isURL(song)) {\n if (!message) song = (await this.search(song, { limit: 1 }))[0];\n else song = await this.handler.searchSong(message, song);\n }\n song = await this.handler.resolveSong(member, song);\n if (!song) return;\n if (song instanceof Playlist) {\n await this.handler.handlePlaylist(voiceChannel, song, textChannel, skip, unshift);\n } else if (!this.options.nsfw && (song as Song).age_restricted && !textChannel?.nsfw) {\n throw new DisTubeError(\"NON_NSFW\");\n } else {\n queue = this.getQueue(voiceChannel);\n if (queue) {\n queue.addToQueue(song as Song, skip || unshift ? 1 : -1);\n if (skip) queue.skip();\n else this.emit(\"addSong\", queue, song);\n } else {\n const newQueue = await this.handler.createQueue(voiceChannel, song as Song, textChannel);\n if (newQueue instanceof Queue) {\n if (this.options.emitAddSongWhenCreatingQueue) this.emit(\"addSong\", newQueue, song);\n this.emit(\"playSong\", newQueue, song);\n }\n }\n }\n } finally {\n if (queuing) queue?.taskQueue.resolve();\n }\n } catch (e: any) {\n if (!(e instanceof DisTubeError)) {\n try {\n e.name = \"PlayError\";\n e.message = `${(song as Song)?.url || song}\\n${e.message}`;\n } catch {}\n }\n this.emitError(e, textChannel);\n }\n }\n\n /**\n * <info>Shorthand method of {@link DisTubeHandler#createCustomPlaylist} and {@link DisTube#playVoiceChannel}\n *\n * If you doesn't have a user message (interaction,...),\n * see {@link DisTubeHandler#createCustomPlaylist} example</info>\n *\n * Play or add array of video urls.\n * {@link DisTube#event:playSong} or {@link DisTube#event:addList} will be emitted\n * with `playlist`'s properties include `properties` parameter's properties such as\n * `user`, `songs`, `duration`, `formattedDuration`, `thumbnail` like {@link Playlist}\n * @returns {Promise<void>}\n * @param {Discord.Message} message A message from guild channel\n * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult\n * @param {Object} [properties={}] Additional properties such as `name`\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly\n * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue\n * (after the playing song if exists)\n * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel\n * @example\n * const songs = [\"https://www.youtube.com/watch?v=xxx\", \"https://www.youtube.com/watch?v=yyy\"];\n * distube.playCustomPlaylist(message, songs, { name: \"My playlist name\" });\n * // Fetching custom playlist sequentially (reduce lag for low specs)\n * distube.playCustomPlaylist(message, songs, { name: \"My playlist name\" }, false, false);\n */\n async playCustomPlaylist(\n message: Message,\n songs: Array<string | Song | SearchResult>,\n properties: any = {},\n options: { skip?: boolean; unshift?: boolean; parallel?: boolean } = {},\n ): Promise<void> {\n try {\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n }\n const { skip, unshift, parallel } = Object.assign(\n {\n skip: false,\n unshift: false,\n parallel: true,\n },\n options,\n );\n const queue = this.getQueue(message);\n const queuing = queue && !queue.taskQueue.hasResolveTask;\n if (queuing) await queue?.taskQueue.queuing(true);\n try {\n const playlist = await this.handler.createCustomPlaylist(message, songs, properties, parallel);\n await this.handler.handlePlaylist(message, playlist, message.channel as TextChannel, skip, unshift);\n } finally {\n if (queuing) queue?.taskQueue.resolve();\n }\n } catch (e: any) {\n this.emitError(e, message.channel as TextChannel);\n }\n }\n\n /**\n * Search for a song.\n * You can customize how user answers instead of send a number.\n * Then use {@link DisTube#play} or {@link DisTube#playVoiceChannel} to play it.\n * @param {string} string The string search for\n * @param {Object} options Search options\n * @param {number} [options.limit=10] Limit the results\n * @param {'video'|'playlist'} [options.type='video'] Type of results (`video` or `playlist`).\n * @param {boolean} [options.safeSearch=false] Whether or not use safe search (YouTube restricted mode)\n * @throws {Error}\n * @returns {Promise<Array<SearchResult>>} Array of results\n */\n async search(\n string: string,\n options: { type?: \"video\" | \"playlist\"; limit?: number; safeSearch?: boolean; retried?: boolean } = {},\n ): Promise<Array<SearchResult>> {\n const opts = Object.assign({ type: \"video\", limit: 10, safeSearch: false }, options);\n if (typeof opts.type !== \"string\" || ![\"video\", \"playlist\"].includes(opts.type)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"video\", \"playlist\"], opts.type, \"options.type\");\n }\n if (typeof opts.limit !== \"number\") throw new DisTubeError(\"INVALID_TYPE\", \"number\", opts.limit, \"options.limit\");\n if (opts.limit < 1) throw new DisTubeError(\"NUMBER_COMPARE\", \"option.limit\", \"bigger or equal to\", 1);\n if (typeof opts.safeSearch !== \"boolean\") {\n throw new DisTubeError(\"INVALID_TYPE\", \"boolean\", opts.safeSearch, \"options.safeSearch\");\n }\n\n try {\n const search = await ytsr(string, opts);\n const results = search.items.map(i => new SearchResult(i));\n if (results.length === 0) throw new DisTubeError(\"NO_RESULT\");\n return results;\n } catch (e) {\n if (options.retried) throw e;\n options.retried = true;\n return this.search(string, options);\n }\n }\n\n /**\n * Get the guild queue\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue?}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"queue\") {\n * const queue = distube.getQueue(message);\n * message.channel.send('Current queue:\\n' + queue.songs.map((song, id) =>\n * `**${id+1}**. [${song.name}](${song.url}) - \\`${song.formattedDuration}\\``\n * ).join(\"\\n\"));\n * }\n * });\n */\n getQueue(queue: GuildIDResolvable): Queue | undefined {\n return this.queues.get(queue);\n }\n\n /**\n * Pause the guild stream\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n pause(queue: GuildIDResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.pause();\n }\n\n /**\n * Resume the guild stream\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n resume(queue: GuildIDResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.resume();\n }\n\n /**\n * Stop the guild stream\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<void>}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"stop\") {\n * distube.stop(message);\n * message.channel.send(\"Stopped the queue!\");\n * }\n * });\n */\n stop(queue: GuildIDResolvable): Promise<void> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.stop();\n }\n\n /**\n * Set the guild stream's volume\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} percent The percentage of volume you want to set\n * @returns {Queue} The guild queue\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"volume\")\n * distube.setVolume(message, Number(args[0]));\n * });\n */\n setVolume(queue: GuildIDResolvable, percent: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setVolume(percent);\n }\n\n /**\n * Skip the playing song if there is a next song in the queue.\n * <info>If {@link Queue#autoplay} is `true` and there is no up next song,\n * DisTube will add and play a related song.</info>\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"skip\")\n * distube.skip(message);\n * });\n */\n skip(queue: GuildIDResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.skip();\n }\n\n /**\n * Play the previous song\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"previous\")\n * distube.previous(message);\n * });\n */\n previous(queue: GuildIDResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.previous();\n }\n\n /**\n * Shuffle the guild queue songs\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Queue>} The guild queue\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"shuffle\")\n * distube.shuffle(message);\n * });\n */\n shuffle(queue: GuildIDResolvable): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.shuffle();\n }\n\n /**\n * Jump to the song number in the queue.\n * The next one is 1, 2,...\n * The previous one is -1, -2,...\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} num The song number to play\n * @returns {Promise<Queue>} The guild queue\n * @throws {Error} if `num` is invalid number (0 < num < {@link Queue#songs}.length)\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"jump\")\n * distube.jump(message, parseInt(args[0]))\n * .catch(err => message.channel.send(\"Invalid song number.\"));\n * });\n */\n jump(queue: GuildIDResolvable, num: number): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.jump(num);\n }\n\n /**\n * Set the repeat mode of the guild queue.\\\n * Toggle mode `(Disabled -> Song -> Queue -> Disabled ->...)` if `mode` is `undefined`\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {RepeatMode?} [mode] The repeat modes (toggle if `undefined`)\n * @returns {RepeatMode} The new repeat mode\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"repeat\") {\n * let mode = distube.setRepeatMode(message, parseInt(args[0]));\n * mode = mode ? mode == 2 ? \"Repeat queue\" : \"Repeat song\" : \"Off\";\n * message.channel.send(\"Set repeat mode to `\" + mode + \"`\");\n * }\n * });\n * @example\n * const { RepeatMode } = require(\"distube\");\n * let mode;\n * switch(distube.setRepeatMode(message, parseInt(args[0]))) {\n * case RepeatMode.DISABLED:\n * mode = \"Off\";\n * break;\n * case RepeatMode.SONG:\n * mode = \"Repeat a song\";\n * break;\n * case RepeatMode.QUEUE:\n * mode = \"Repeat all queue\";\n * break;\n * }\n * message.channel.send(\"Set repeat mode to `\" + mode + \"`\");\n */\n setRepeatMode(queue: GuildIDResolvable, mode?: number): number {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setRepeatMode(mode);\n }\n\n /**\n * Toggle autoplay mode\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {boolean} Autoplay mode state\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"autoplay\") {\n * const mode = distube.toggleAutoplay(message);\n * message.channel.send(\"Set autoplay mode to `\" + (mode ? \"On\" : \"Off\") + \"`\");\n * }\n * });\n */\n toggleAutoplay(queue: GuildIDResolvable): boolean {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n q.autoplay = !q.autoplay;\n return q.autoplay;\n }\n\n /**\n * Add related song to the queue\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The guild queue\n */\n addRelatedSong(queue: GuildIDResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.addRelatedSong();\n }\n\n /**\n * Enable or disable filter(s) of the queue.\n * Available filters: {@link Filters}\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {string|false} filter A filter name, `false` to clear all the filters\n * @param {boolean} [force=false] Force enable the input filter(s) even if it's enabled\n * @returns {Array<string>} Enabled filters.\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if ([`3d`, `bassboost`, `echo`, `karaoke`, `nightcore`, `vaporwave`].includes(command)) {\n * const filter = distube.setFilter(message, command);\n * message.channel.send(\"Current queue filter: \" + (filter.join(\", \") || \"Off\"));\n * }\n * });\n */\n setFilter(queue: GuildIDResolvable, filter: string | false, force = false): Array<string> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setFilter(filter, force);\n }\n\n /**\n * Set the playing time to another position\n * @param {GuildIDResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} time Time in seconds\n * @returns {Queue} Seeked queue\n * @example\n * client.on('message', message => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command = 'seek')\n * distube.seek(message, Number(args[0]));\n * });\n */\n seek(queue: GuildIDResolvable, time: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.seek(time);\n }\n\n /* eslint-disable no-console */\n /**\n * Emit error event\n * @param {Error} error error\n * @param {Discord.TextChannel?} channel Text channel where the error is encountered.\n * @private\n */\n emitError(error: Error, channel?: TextChannel): void {\n if (!channel || !isTextChannelInstance(channel)) {\n console.error(error);\n console.warn(\"This is logged because <Queue>.textChannel is undefined\");\n } else if (this.listeners(\"error\").length) {\n this.emit(\"error\", channel, error);\n } else {\n console.error(error);\n console.warn(\"Unhandled 'error' event.\");\n console.warn(\n \"See: https://distube.js.org/#/docs/DisTube/beta/class/DisTube?scrollTo=e-error and https://nodejs.org/api/events.html#events_error_events\",\n );\n }\n }\n /* eslint-enable no-console */\n}\n\nexport default DisTube;\n\n/**\n * Emitted after DisTube add a new playlist to the playing {@link Queue}.\n *\n * @event DisTube#addList\n * @param {Queue} queue The guild queue\n * @param {Playlist} playlist Playlist info\n * @example\n * distube.on(\"addList\", (queue, playlist) => queue.textChannel.send(\n * `Added \\`${playlist.name}\\` playlist (${playlist.songs.length} songs) to the queue!`\n * ));\n */\n\n/**\n * Emitted after DisTube add a new song to the playing {@link Queue}.\n *\n * @event DisTube#addSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Added song\n * @example\n * distube.on(\"addSong\", (queue, song) => queue.textChannel.send(\n * `Added ${song.name} - \\`${song.formattedDuration}\\` to the queue by ${song.user}.`\n * ));\n */\n\n/**\n * Emitted when there is no user in the voice channel,\n * {@link DisTubeOptions}.leaveOnEmpty is `true` and there is a playing queue.\n *\n * If there is no playing queue (stopped and {@link DisTubeOptions}.leaveOnStop is `false`),\n * it will leave the channel without emitting this event.\n * @event DisTube#empty\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"empty\", queue => queue.textChannel.send(\"Channel is empty. Leaving the channel\"))\n */\n\n/**\n * Emitted when DisTube encounters an error.\n *\n * @event DisTube#error\n * @param {Discord.TextChannel} channel Text channel where the error is encountered.\n * @param {Error} error The error encountered\n * @example\n * distube.on(\"error\", (channel, error) => channel.send(\n * \"An error encountered: \" + error\n * ));\n */\n\n/**\n * Emitted when there is no more song in the queue and {@link Queue#autoplay} is `false`.\n * DisTube will leave voice channel if {@link DisTubeOptions}.leaveOnFinish is `true`.\n *\n * @event DisTube#finish\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"finish\", queue => queue.textChannel.send(\"No more song in queue\"));\n */\n\n/**\n * Emitted when DisTube initialize a queue to change queue default properties.\n *\n * @event DisTube#initQueue\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"initQueue\", queue => {\n * queue.autoplay = false;\n * queue.volume = 100;\n * });\n */\n\n/**\n * Emitted when {@link Queue#autoplay} is `true`, {@link Queue#songs} is empty,\n * and DisTube cannot find related songs to play.\n *\n * @event DisTube#noRelated\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"noRelated\", queue => queue.textChannel.send(\"Can't find related video to play.\"));\n */\n\n/**\n * Emitted when DisTube play a song.\n *\n * If {@link DisTubeOptions}.emitNewSongOnly is `true`,\n * this event is not emitted when looping a song or next song is the previous one.\n *\n * @event DisTube#playSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Playing song\n * @example\n * distube.on(\"playSong\", (queue, song) => queue.textChannel.send(\n * `Playing \\`${song.name}\\` - \\`${song.formattedDuration}\\`\\nRequested by: ${song.user}`\n * ));\n */\n\n/**\n * Emitted when DisTube cannot find any results for the query.\n *\n * @event DisTube#searchNoResult\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * distube.on(\"searchNoResult\", (message, query) => message.channel.send(`No result found for ${query}!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and song param of {@link DisTube#playVoiceChannel} is invalid url.\n * DisTube will wait for user's next message to choose a song manually.\n * <info>{@link https://support.google.com/youtube/answer/7354993|Safe search} is enabled\n * if {@link DisTubeOptions}.nsfw is disabled and the message's channel is not a nsfw channel.</info>\n *\n * @event DisTube#searchResult\n * @param {Discord.Message} message The user message called play method\n * @param {Array<SearchResult>} results Searched results\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchResult\", (message, results) => {\n * message.channel.send(`**Choose an option from below**\\n${\n * results.map((song, i) => `**${i + 1}**. ${song.name} - \\`${song.formattedDuration}\\``).join(\"\\n\")\n * }\\n*Enter anything else or wait 60 seconds to cancel*`);\n * });\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and the search canceled due to {@link DisTubeOptions|DisTubeOptions.searchTimeout}.\n *\n * @event DisTube#searchCancel\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchCancel\", (message) => message.channel.send(`Searching canceled`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and the search canceled due to user's next message is not a number or out of results range.\n *\n * @event DisTube#searchInvalidAnswer\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchInvalidAnswer\", (message) => message.channel.send(`You answered an invalid number!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and after the user chose a search result to play.\n *\n * @event DisTube#searchDone\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n */\n\n/**\n * Emitted when the bot is disconnected to a voice channel.\n *\n * @event DisTube#disconnect\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when a {@link Queue} is deleted with any reasons.\n *\n * @event DisTube#deleteQueue\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when DisTube finished a song.\n *\n * @event DisTube#finishSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Finished song\n */\n"]}
|
package/dist/constant.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Filters } from ".";
|
|
2
2
|
/**
|
|
3
3
|
* Default DisTube audio filters.
|
|
4
|
-
* @typedef {Object}
|
|
4
|
+
* @typedef {Object} defaultFilters
|
|
5
5
|
* @prop {string} 3d 3d
|
|
6
6
|
* @prop {string} bassboost bassboost
|
|
7
7
|
* @prop {string} echo echo
|
|
@@ -23,21 +23,29 @@ export declare const defaultFilters: Filters;
|
|
|
23
23
|
* DisTube options.
|
|
24
24
|
* @typedef {Object} DisTubeOptions
|
|
25
25
|
* @prop {Array<CustomPlugin|ExtractorPlugin>} [plugins] DisTube plugins.
|
|
26
|
-
* @prop {boolean} [emitNewSongOnly=false]
|
|
27
|
-
*
|
|
26
|
+
* @prop {boolean} [emitNewSongOnly=false] Whether or not emitting {@link DisTube#event:playSong} event
|
|
27
|
+
* when looping a song or next song is the same as the previous one
|
|
28
|
+
* @prop {boolean} [leaveOnEmpty=true] Whether or not leaving voice channel
|
|
29
|
+
* if the voice channel is empty after {@link DisTubeOptions}.emptyCooldown seconds.
|
|
28
30
|
* @prop {boolean} [leaveOnFinish=false] Whether or not leaving voice channel when the queue ends.
|
|
29
31
|
* @prop {boolean} [leaveOnStop=true] Whether or not leaving voice channel after using {@link DisTube#stop} function.
|
|
30
|
-
* @prop {boolean} [savePreviousSongs=true] Whether or not saving the previous songs of the queue
|
|
31
|
-
*
|
|
32
|
-
* @prop {
|
|
33
|
-
* @
|
|
32
|
+
* @prop {boolean} [savePreviousSongs=true] Whether or not saving the previous songs of the queue
|
|
33
|
+
* and enable {@link DisTube#previous} method
|
|
34
|
+
* @prop {number} [searchSongs=0] Limit of search results emits in {@link DisTube#event:searchResult} event
|
|
35
|
+
* when {@link DisTube#play} method executed. If `searchSongs <= 1`, play the first result
|
|
36
|
+
* @prop {string} [youtubeCookie] YouTube cookies. Read how to get it in
|
|
37
|
+
* {@link https://github.com/fent/node-ytdl-core/blob/997efdd5dd9063363f6ef668bb364e83970756e7/example/cookies.js#L6-L12|YTDL's Example}
|
|
38
|
+
* @prop {string} [youtubeIdentityToken] If not given; ytdl-core will try to find it.
|
|
39
|
+
* You can find this by going to a video's watch page; viewing the source; and searching for "ID_TOKEN".
|
|
34
40
|
* @prop {boolean} [youtubeDL=true] Whether or not using youtube-dl.
|
|
35
41
|
* @prop {boolean} [updateYouTubeDL=true] Whether or not updating youtube-dl automatically.
|
|
36
|
-
* @prop {Filters} [customFilters] Override {@link defaultFilters} or add more ffmpeg filters.
|
|
42
|
+
* @prop {Filters} [customFilters] Override {@link defaultFilters} or add more ffmpeg filters.
|
|
43
|
+
* Example=`{ "Filter name"="Filter value"; "8d"="apulsator=hz=0.075" }`
|
|
37
44
|
* @prop {ytdl.getInfoOptions} [ytdlOptions] `ytdl-core` get info options
|
|
38
45
|
* @prop {number} [searchCooldown=60] Built-in search cooldown in seconds (When searchSongs is bigger than 0)
|
|
39
46
|
* @prop {number} [emptyCooldown=60] Built-in leave on empty cooldown in seconds (When leaveOnEmpty is true)
|
|
40
|
-
* @prop {boolean} [nsfw=false] Whether or not playing age-restricted content
|
|
47
|
+
* @prop {boolean} [nsfw=false] Whether or not playing age-restricted content
|
|
48
|
+
* and disabling safe search in non-NSFW channel.
|
|
41
49
|
* @prop {boolean} [emitAddListWhenCreatingQueue=true] Whether or not emitting `addList` event when creating a new Queue
|
|
42
50
|
* @prop {boolean} [emitAddSongWhenCreatingQueue=true] Whether or not emitting `addSong` event when creating a new Queue
|
|
43
51
|
*/
|
|
@@ -71,7 +79,20 @@ export declare const defaultOptions: {
|
|
|
71
79
|
* - A {@link https://discord.js.org/#/docs/main/master/class/GuildMember|GuildMember}
|
|
72
80
|
* - A {@link https://discord.js.org/#/docs/main/master/class/Interaction|Interaction}
|
|
73
81
|
* - A {@link Queue}
|
|
74
|
-
* @
|
|
82
|
+
* - A {@link DisTubeVoice}
|
|
83
|
+
* @typedef {
|
|
84
|
+
* Discord.Snowflake|
|
|
85
|
+
* Discord.Message|
|
|
86
|
+
* Discord.VoiceChannel|
|
|
87
|
+
* Discord.StageChannel|
|
|
88
|
+
* Discord.VoiceState|
|
|
89
|
+
* Discord.TextChannel|
|
|
90
|
+
* Discord.GuildMember|
|
|
91
|
+
* Discord.Interaction|
|
|
92
|
+
* DisTubeVoice|
|
|
93
|
+
* Queue|
|
|
94
|
+
* string
|
|
95
|
+
* } GuildIDResolvable
|
|
75
96
|
*/
|
|
76
97
|
/**
|
|
77
98
|
* FFmpeg Filters
|
|
@@ -84,4 +105,16 @@ export declare const defaultOptions: {
|
|
|
84
105
|
* @typedef {Object.<string, string>} Filters
|
|
85
106
|
* @see {@link defaultFilters}
|
|
86
107
|
*/
|
|
108
|
+
/**
|
|
109
|
+
* The repeat mode of a {@link Queue} (enum)
|
|
110
|
+
* * DISABLED
|
|
111
|
+
* * SONG
|
|
112
|
+
* * QUEUE
|
|
113
|
+
* @typedef {number} RepeatMode
|
|
114
|
+
*/
|
|
115
|
+
export declare enum RepeatMode {
|
|
116
|
+
DISABLED = 0,
|
|
117
|
+
SONG = 1,
|
|
118
|
+
QUEUE = 2
|
|
119
|
+
}
|
|
87
120
|
//# sourceMappingURL=constant.d.ts.map
|
package/dist/constant.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAEjC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,EAAE,OAgB5B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAEjC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,EAAE,OAgB5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;CAiB1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,oBAAY,UAAU;IACpB,QAAQ,IAAA;IACR,IAAI,IAAA;IACJ,KAAK,IAAA;CACN"}
|
package/dist/constant.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultOptions = exports.defaultFilters = void 0;
|
|
3
|
+
exports.RepeatMode = exports.defaultOptions = exports.defaultFilters = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Default DisTube audio filters.
|
|
6
|
-
* @typedef {Object}
|
|
6
|
+
* @typedef {Object} defaultFilters
|
|
7
7
|
* @prop {string} 3d 3d
|
|
8
8
|
* @prop {string} bassboost bassboost
|
|
9
9
|
* @prop {string} echo echo
|
|
@@ -41,21 +41,29 @@ exports.defaultFilters = {
|
|
|
41
41
|
* DisTube options.
|
|
42
42
|
* @typedef {Object} DisTubeOptions
|
|
43
43
|
* @prop {Array<CustomPlugin|ExtractorPlugin>} [plugins] DisTube plugins.
|
|
44
|
-
* @prop {boolean} [emitNewSongOnly=false]
|
|
45
|
-
*
|
|
44
|
+
* @prop {boolean} [emitNewSongOnly=false] Whether or not emitting {@link DisTube#event:playSong} event
|
|
45
|
+
* when looping a song or next song is the same as the previous one
|
|
46
|
+
* @prop {boolean} [leaveOnEmpty=true] Whether or not leaving voice channel
|
|
47
|
+
* if the voice channel is empty after {@link DisTubeOptions}.emptyCooldown seconds.
|
|
46
48
|
* @prop {boolean} [leaveOnFinish=false] Whether or not leaving voice channel when the queue ends.
|
|
47
49
|
* @prop {boolean} [leaveOnStop=true] Whether or not leaving voice channel after using {@link DisTube#stop} function.
|
|
48
|
-
* @prop {boolean} [savePreviousSongs=true] Whether or not saving the previous songs of the queue
|
|
49
|
-
*
|
|
50
|
-
* @prop {
|
|
51
|
-
* @
|
|
50
|
+
* @prop {boolean} [savePreviousSongs=true] Whether or not saving the previous songs of the queue
|
|
51
|
+
* and enable {@link DisTube#previous} method
|
|
52
|
+
* @prop {number} [searchSongs=0] Limit of search results emits in {@link DisTube#event:searchResult} event
|
|
53
|
+
* when {@link DisTube#play} method executed. If `searchSongs <= 1`, play the first result
|
|
54
|
+
* @prop {string} [youtubeCookie] YouTube cookies. Read how to get it in
|
|
55
|
+
* {@link https://github.com/fent/node-ytdl-core/blob/997efdd5dd9063363f6ef668bb364e83970756e7/example/cookies.js#L6-L12|YTDL's Example}
|
|
56
|
+
* @prop {string} [youtubeIdentityToken] If not given; ytdl-core will try to find it.
|
|
57
|
+
* You can find this by going to a video's watch page; viewing the source; and searching for "ID_TOKEN".
|
|
52
58
|
* @prop {boolean} [youtubeDL=true] Whether or not using youtube-dl.
|
|
53
59
|
* @prop {boolean} [updateYouTubeDL=true] Whether or not updating youtube-dl automatically.
|
|
54
|
-
* @prop {Filters} [customFilters] Override {@link defaultFilters} or add more ffmpeg filters.
|
|
60
|
+
* @prop {Filters} [customFilters] Override {@link defaultFilters} or add more ffmpeg filters.
|
|
61
|
+
* Example=`{ "Filter name"="Filter value"; "8d"="apulsator=hz=0.075" }`
|
|
55
62
|
* @prop {ytdl.getInfoOptions} [ytdlOptions] `ytdl-core` get info options
|
|
56
63
|
* @prop {number} [searchCooldown=60] Built-in search cooldown in seconds (When searchSongs is bigger than 0)
|
|
57
64
|
* @prop {number} [emptyCooldown=60] Built-in leave on empty cooldown in seconds (When leaveOnEmpty is true)
|
|
58
|
-
* @prop {boolean} [nsfw=false] Whether or not playing age-restricted content
|
|
65
|
+
* @prop {boolean} [nsfw=false] Whether or not playing age-restricted content
|
|
66
|
+
* and disabling safe search in non-NSFW channel.
|
|
59
67
|
* @prop {boolean} [emitAddListWhenCreatingQueue=true] Whether or not emitting `addList` event when creating a new Queue
|
|
60
68
|
* @prop {boolean} [emitAddSongWhenCreatingQueue=true] Whether or not emitting `addSong` event when creating a new Queue
|
|
61
69
|
*/
|
|
@@ -89,7 +97,20 @@ exports.defaultOptions = {
|
|
|
89
97
|
* - A {@link https://discord.js.org/#/docs/main/master/class/GuildMember|GuildMember}
|
|
90
98
|
* - A {@link https://discord.js.org/#/docs/main/master/class/Interaction|Interaction}
|
|
91
99
|
* - A {@link Queue}
|
|
92
|
-
* @
|
|
100
|
+
* - A {@link DisTubeVoice}
|
|
101
|
+
* @typedef {
|
|
102
|
+
* Discord.Snowflake|
|
|
103
|
+
* Discord.Message|
|
|
104
|
+
* Discord.VoiceChannel|
|
|
105
|
+
* Discord.StageChannel|
|
|
106
|
+
* Discord.VoiceState|
|
|
107
|
+
* Discord.TextChannel|
|
|
108
|
+
* Discord.GuildMember|
|
|
109
|
+
* Discord.Interaction|
|
|
110
|
+
* DisTubeVoice|
|
|
111
|
+
* Queue|
|
|
112
|
+
* string
|
|
113
|
+
* } GuildIDResolvable
|
|
93
114
|
*/
|
|
94
115
|
/**
|
|
95
116
|
* FFmpeg Filters
|
|
@@ -102,4 +123,17 @@ exports.defaultOptions = {
|
|
|
102
123
|
* @typedef {Object.<string, string>} Filters
|
|
103
124
|
* @see {@link defaultFilters}
|
|
104
125
|
*/
|
|
126
|
+
/**
|
|
127
|
+
* The repeat mode of a {@link Queue} (enum)
|
|
128
|
+
* * DISABLED
|
|
129
|
+
* * SONG
|
|
130
|
+
* * QUEUE
|
|
131
|
+
* @typedef {number} RepeatMode
|
|
132
|
+
*/
|
|
133
|
+
var RepeatMode;
|
|
134
|
+
(function (RepeatMode) {
|
|
135
|
+
RepeatMode[RepeatMode["DISABLED"] = 0] = "DISABLED";
|
|
136
|
+
RepeatMode[RepeatMode["SONG"] = 1] = "SONG";
|
|
137
|
+
RepeatMode[RepeatMode["QUEUE"] = 2] = "QUEUE";
|
|
138
|
+
})(RepeatMode = exports.RepeatMode || (exports.RepeatMode = {}));
|
|
105
139
|
//# sourceMappingURL=constant.js.map
|
package/dist/constant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,cAAc,GAAY;IACrC,IAAI,EAAE,oBAAoB;IAC1B,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,sBAAsB;IAC/B,SAAS,EAAE,8CAA8C;IACzD,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,+CAA+C;IAC1D,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,cAAc,GAAY;IACrC,IAAI,EAAE,oBAAoB;IAC1B,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,sBAAsB;IAC/B,SAAS,EAAE,8CAA8C;IACzD,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,+CAA+C;IAC1D,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACU,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,EAAE;IACX,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,IAAI;IACvB,SAAS,EAAE,IAAI;IACf,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,EAAE;IACjB,WAAW,EAAE,EAAE;IACf,cAAc,EAAE,EAAE;IAClB,aAAa,EAAE,EAAE;IACjB,IAAI,EAAE,KAAK;IACX,4BAA4B,EAAE,IAAI;IAClC,4BAA4B,EAAE,IAAI;CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,mDAAQ,CAAA;IACR,2CAAI,CAAA;IACJ,6CAAK,CAAA;AACP,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB","sourcesContent":["import type { Filters } from \".\";\n\n/**\n * Default DisTube audio filters.\n * @typedef {Object} defaultFilters\n * @prop {string} 3d 3d\n * @prop {string} bassboost bassboost\n * @prop {string} echo echo\n * @prop {string} karaoke karaoke\n * @prop {string} nightcore nightcore\n * @prop {string} vaporwave vaporwave\n * @prop {string} flanger flanger\n * @prop {string} gate gate\n * @prop {string} haas haas\n * @prop {string} reverse reverse\n * @prop {string} surround surround\n * @prop {string} mcompand mcompand\n * @prop {string} phaser phaser\n * @prop {string} tremolo tremolo\n * @prop {string} earwax earwax\n */\nexport const defaultFilters: Filters = {\n \"3d\": \"apulsator=hz=0.125\",\n bassboost: \"bass=g=10\",\n echo: \"aecho=0.8:0.9:1000:0.3\",\n flanger: \"flanger\",\n gate: \"agate\",\n haas: \"haas\",\n karaoke: \"stereotools=mlev=0.1\",\n nightcore: \"asetrate=48000*1.25,aresample=48000,bass=g=5\",\n reverse: \"areverse\",\n vaporwave: \"asetrate=48000*0.8,aresample=48000,atempo=1.1\",\n mcompand: \"mcompand\",\n phaser: \"aphaser\",\n tremolo: \"tremolo\",\n surround: \"surround\",\n earwax: \"earwax\",\n};\n\n/**\n * DisTube options.\n * @typedef {Object} DisTubeOptions\n * @prop {Array<CustomPlugin|ExtractorPlugin>} [plugins] DisTube plugins.\n * @prop {boolean} [emitNewSongOnly=false] Whether or not emitting {@link DisTube#event:playSong} event\n * when looping a song or next song is the same as the previous one\n * @prop {boolean} [leaveOnEmpty=true] Whether or not leaving voice channel\n * if the voice channel is empty after {@link DisTubeOptions}.emptyCooldown seconds.\n * @prop {boolean} [leaveOnFinish=false] Whether or not leaving voice channel when the queue ends.\n * @prop {boolean} [leaveOnStop=true] Whether or not leaving voice channel after using {@link DisTube#stop} function.\n * @prop {boolean} [savePreviousSongs=true] Whether or not saving the previous songs of the queue\n * and enable {@link DisTube#previous} method\n * @prop {number} [searchSongs=0] Limit of search results emits in {@link DisTube#event:searchResult} event\n * when {@link DisTube#play} method executed. If `searchSongs <= 1`, play the first result\n * @prop {string} [youtubeCookie] YouTube cookies. Read how to get it in\n * {@link https://github.com/fent/node-ytdl-core/blob/997efdd5dd9063363f6ef668bb364e83970756e7/example/cookies.js#L6-L12|YTDL's Example}\n * @prop {string} [youtubeIdentityToken] If not given; ytdl-core will try to find it.\n * You can find this by going to a video's watch page; viewing the source; and searching for \"ID_TOKEN\".\n * @prop {boolean} [youtubeDL=true] Whether or not using youtube-dl.\n * @prop {boolean} [updateYouTubeDL=true] Whether or not updating youtube-dl automatically.\n * @prop {Filters} [customFilters] Override {@link defaultFilters} or add more ffmpeg filters.\n * Example=`{ \"Filter name\"=\"Filter value\"; \"8d\"=\"apulsator=hz=0.075\" }`\n * @prop {ytdl.getInfoOptions} [ytdlOptions] `ytdl-core` get info options\n * @prop {number} [searchCooldown=60] Built-in search cooldown in seconds (When searchSongs is bigger than 0)\n * @prop {number} [emptyCooldown=60] Built-in leave on empty cooldown in seconds (When leaveOnEmpty is true)\n * @prop {boolean} [nsfw=false] Whether or not playing age-restricted content\n * and disabling safe search in non-NSFW channel.\n * @prop {boolean} [emitAddListWhenCreatingQueue=true] Whether or not emitting `addList` event when creating a new Queue\n * @prop {boolean} [emitAddSongWhenCreatingQueue=true] Whether or not emitting `addSong` event when creating a new Queue\n */\nexport const defaultOptions = {\n plugins: [],\n emitNewSongOnly: false,\n leaveOnEmpty: true,\n leaveOnFinish: false,\n leaveOnStop: true,\n savePreviousSongs: true,\n youtubeDL: true,\n updateYouTubeDL: true,\n searchSongs: 0,\n customFilters: {},\n ytdlOptions: {},\n searchCooldown: 60,\n emptyCooldown: 60,\n nsfw: false,\n emitAddSongWhenCreatingQueue: true,\n emitAddListWhenCreatingQueue: true,\n};\n\n/**\n * Data that can be resolved to give a guild ID string. This can be:\n * - A guild ID string | a guild {@link https://discord.js.org/#/docs/main/master/class/Snowflake|Snowflake}\n * - A {@link https://discord.js.org/#/docs/main/master/class/Guild|Guild}\n * - A {@link https://discord.js.org/#/docs/main/master/class/Message|Message}\n * - A {@link https://discord.js.org/#/docs/main/master/class/TextChannel|TextChannel}\n * - A {@link https://discord.js.org/#/docs/main/master/class/VoiceChannel|VoiceChannel}\n * - A {@link https://discord.js.org/#/docs/main/master/class/StageChannel|StageChannel}\n * - A {@link https://discord.js.org/#/docs/main/master/class/VoiceState|VoiceState}\n * - A {@link https://discord.js.org/#/docs/main/master/class/GuildMember|GuildMember}\n * - A {@link https://discord.js.org/#/docs/main/master/class/Interaction|Interaction}\n * - A {@link Queue}\n * - A {@link DisTubeVoice}\n * @typedef {\n * Discord.Snowflake|\n * Discord.Message|\n * Discord.VoiceChannel|\n * Discord.StageChannel|\n * Discord.VoiceState|\n * Discord.TextChannel|\n * Discord.GuildMember|\n * Discord.Interaction|\n * DisTubeVoice|\n * Queue|\n * string\n * } GuildIDResolvable\n */\n/**\n * FFmpeg Filters\n * ```\n * {\n * \"Filter Name\": \"Filter Value\",\n * \"bassboost\": \"bass=g=10\"\n * }\n * ```\n * @typedef {Object.<string, string>} Filters\n * @see {@link defaultFilters}\n */\n\n/**\n * The repeat mode of a {@link Queue} (enum)\n * * DISABLED\n * * SONG\n * * QUEUE\n * @typedef {number} RepeatMode\n */\nexport enum RepeatMode {\n DISABLED,\n SONG,\n QUEUE,\n}\n"]}
|
|
@@ -1,59 +1,53 @@
|
|
|
1
|
-
import type DisTube from "../DisTube";
|
|
2
|
-
import type DisTubeHandler from "./DisTubeHandler";
|
|
3
1
|
import type { Client, TextChannel } from "discord.js";
|
|
4
|
-
import type { DisTubeVoiceManager, Options, QueueManager } from "
|
|
5
|
-
/**
|
|
6
|
-
|
|
2
|
+
import type { DisTube, DisTubeEvents, DisTubeHandler, DisTubeVoiceManager, Options, QueueManager } from "..";
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
* @abstract
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class DisTubeBase {
|
|
7
8
|
distube: DisTube;
|
|
8
9
|
constructor(distube: DisTube);
|
|
9
10
|
/**
|
|
10
11
|
* Emit the {@link DisTube} of this base
|
|
11
|
-
* @private
|
|
12
12
|
* @param {string} eventName Event name
|
|
13
13
|
* @param {...any} args arguments
|
|
14
14
|
* @returns {boolean}
|
|
15
15
|
*/
|
|
16
|
-
emit(eventName:
|
|
16
|
+
emit(eventName: keyof DisTubeEvents, ...args: any): boolean;
|
|
17
17
|
/**
|
|
18
18
|
* Emit error event
|
|
19
19
|
* @param {Error} error error
|
|
20
20
|
* @param {Discord.TextChannel?} channel Text channel where the error is encountered.
|
|
21
|
-
* @private
|
|
22
21
|
*/
|
|
23
22
|
emitError(error: Error, channel?: TextChannel): void;
|
|
24
23
|
/**
|
|
25
24
|
* The queue manager
|
|
26
25
|
* @type {QueueManager}
|
|
27
26
|
* @readonly
|
|
28
|
-
* @private
|
|
29
27
|
*/
|
|
30
28
|
get queues(): QueueManager;
|
|
31
29
|
/**
|
|
32
30
|
* The voice manager
|
|
33
31
|
* @type {DisTubeVoiceManager}
|
|
34
32
|
* @readonly
|
|
35
|
-
* @private
|
|
36
33
|
*/
|
|
37
34
|
get voices(): DisTubeVoiceManager;
|
|
38
35
|
/**
|
|
39
36
|
* Discord.js client
|
|
40
37
|
* @type {Discord.Client}
|
|
41
38
|
* @readonly
|
|
42
|
-
* @private
|
|
43
39
|
*/
|
|
44
40
|
get client(): Client;
|
|
45
41
|
/**
|
|
46
42
|
* DisTube options
|
|
47
43
|
* @type {DisTubeOptions}
|
|
48
44
|
* @readonly
|
|
49
|
-
* @private
|
|
50
45
|
*/
|
|
51
46
|
get options(): Options;
|
|
52
47
|
/**
|
|
53
48
|
* DisTube handler
|
|
54
49
|
* @type {DisTubeHandler}
|
|
55
50
|
* @readonly
|
|
56
|
-
* @private
|
|
57
51
|
*/
|
|
58
52
|
get handler(): DisTubeHandler;
|
|
59
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisTubeBase.d.ts","sourceRoot":"","sources":["../../src/core/DisTubeBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"DisTubeBase.d.ts","sourceRoot":"","sources":["../../src/core/DisTubeBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAE7G;;;GAGG;AACH,8BAAsB,WAAW;IAC/B,OAAO,EAAE,OAAO,CAAC;gBACL,OAAO,EAAE,OAAO;IAO5B;;;;;OAKG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO;IAG3D;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,WAAW;IAG7C;;;;OAIG;IACH,IAAI,MAAM,IAAI,YAAY,CAEzB;IACD;;;;OAIG;IACH,IAAI,MAAM,IAAI,mBAAmB,CAEhC;IACD;;;;OAIG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IACD;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IACD;;;;OAIG;IACH,IAAI,OAAO,IAAI,cAAc,CAE5B;CACF;AAED,eAAe,WAAW,CAAC"}
|
package/dist/core/DisTubeBase.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DisTubeBase = void 0;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* @abstract
|
|
7
|
+
*/
|
|
5
8
|
class DisTubeBase {
|
|
6
9
|
constructor(distube) {
|
|
7
10
|
/**
|
|
8
11
|
* DisTube
|
|
9
12
|
* @type {DisTube}
|
|
10
|
-
* @private
|
|
11
13
|
*/
|
|
12
14
|
this.distube = distube;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Emit the {@link DisTube} of this base
|
|
16
|
-
* @private
|
|
17
18
|
* @param {string} eventName Event name
|
|
18
19
|
* @param {...any} args arguments
|
|
19
20
|
* @returns {boolean}
|
|
@@ -25,7 +26,6 @@ class DisTubeBase {
|
|
|
25
26
|
* Emit error event
|
|
26
27
|
* @param {Error} error error
|
|
27
28
|
* @param {Discord.TextChannel?} channel Text channel where the error is encountered.
|
|
28
|
-
* @private
|
|
29
29
|
*/
|
|
30
30
|
emitError(error, channel) {
|
|
31
31
|
this.distube.emitError(error, channel);
|
|
@@ -34,7 +34,6 @@ class DisTubeBase {
|
|
|
34
34
|
* The queue manager
|
|
35
35
|
* @type {QueueManager}
|
|
36
36
|
* @readonly
|
|
37
|
-
* @private
|
|
38
37
|
*/
|
|
39
38
|
get queues() {
|
|
40
39
|
return this.distube.queues;
|
|
@@ -43,7 +42,6 @@ class DisTubeBase {
|
|
|
43
42
|
* The voice manager
|
|
44
43
|
* @type {DisTubeVoiceManager}
|
|
45
44
|
* @readonly
|
|
46
|
-
* @private
|
|
47
45
|
*/
|
|
48
46
|
get voices() {
|
|
49
47
|
return this.distube.voices;
|
|
@@ -52,7 +50,6 @@ class DisTubeBase {
|
|
|
52
50
|
* Discord.js client
|
|
53
51
|
* @type {Discord.Client}
|
|
54
52
|
* @readonly
|
|
55
|
-
* @private
|
|
56
53
|
*/
|
|
57
54
|
get client() {
|
|
58
55
|
return this.distube.client;
|
|
@@ -61,7 +58,6 @@ class DisTubeBase {
|
|
|
61
58
|
* DisTube options
|
|
62
59
|
* @type {DisTubeOptions}
|
|
63
60
|
* @readonly
|
|
64
|
-
* @private
|
|
65
61
|
*/
|
|
66
62
|
get options() {
|
|
67
63
|
return this.distube.options;
|
|
@@ -70,7 +66,6 @@ class DisTubeBase {
|
|
|
70
66
|
* DisTube handler
|
|
71
67
|
* @type {DisTubeHandler}
|
|
72
68
|
* @readonly
|
|
73
|
-
* @private
|
|
74
69
|
*/
|
|
75
70
|
get handler() {
|
|
76
71
|
return this.distube.handler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisTubeBase.js","sourceRoot":"","sources":["../../src/core/DisTubeBase.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"DisTubeBase.js","sourceRoot":"","sources":["../../src/core/DisTubeBase.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH,MAAsB,WAAW;IAE/B,YAAY,OAAgB;QAC1B;;;WAGG;QACH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACH,IAAI,CAAC,SAA8B,EAAE,GAAG,IAAS;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD;;;;OAIG;IACH,SAAS,CAAC,KAAY,EAAE,OAAqB;QAC3C,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IACD;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD;;;;OAIG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC9B,CAAC;IACD;;;;OAIG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC9B,CAAC;CACF;AAlED,kCAkEC;AAED,kBAAe,WAAW,CAAC","sourcesContent":["import type { Client, TextChannel } from \"discord.js\";\nimport type { DisTube, DisTubeEvents, DisTubeHandler, DisTubeVoiceManager, Options, QueueManager } from \"..\";\n\n/**\n * @private\n * @abstract\n */\nexport abstract class DisTubeBase {\n distube: DisTube;\n constructor(distube: DisTube) {\n /**\n * DisTube\n * @type {DisTube}\n */\n this.distube = distube;\n }\n /**\n * Emit the {@link DisTube} of this base\n * @param {string} eventName Event name\n * @param {...any} args arguments\n * @returns {boolean}\n */\n emit(eventName: keyof DisTubeEvents, ...args: any): boolean {\n return this.distube.emit(eventName, ...args);\n }\n /**\n * Emit error event\n * @param {Error} error error\n * @param {Discord.TextChannel?} channel Text channel where the error is encountered.\n */\n emitError(error: Error, channel?: TextChannel) {\n this.distube.emitError(error, channel);\n }\n /**\n * The queue manager\n * @type {QueueManager}\n * @readonly\n */\n get queues(): QueueManager {\n return this.distube.queues;\n }\n /**\n * The voice manager\n * @type {DisTubeVoiceManager}\n * @readonly\n */\n get voices(): DisTubeVoiceManager {\n return this.distube.voices;\n }\n /**\n * Discord.js client\n * @type {Discord.Client}\n * @readonly\n */\n get client(): Client {\n return this.distube.client;\n }\n /**\n * DisTube options\n * @type {DisTubeOptions}\n * @readonly\n */\n get options(): Options {\n return this.distube.options;\n }\n /**\n * DisTube handler\n * @type {DisTubeHandler}\n * @readonly\n */\n get handler(): DisTubeHandler {\n return this.distube.handler;\n }\n}\n\nexport default DisTubeBase;\n"]}
|