distube 2.8.18 → 3.0.0-0

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.
Files changed (139) hide show
  1. package/README.md +32 -98
  2. package/dist/DisTube.d.ts +522 -0
  3. package/dist/DisTube.d.ts.map +1 -0
  4. package/dist/DisTube.js +794 -0
  5. package/dist/DisTube.js.map +1 -0
  6. package/dist/constant.d.ts +130 -0
  7. package/dist/constant.d.ts.map +1 -0
  8. package/dist/constant.js +150 -0
  9. package/dist/constant.js.map +1 -0
  10. package/dist/core/DisTubeBase.d.ts +55 -0
  11. package/dist/core/DisTubeBase.d.ts.map +1 -0
  12. package/dist/core/DisTubeBase.js +76 -0
  13. package/dist/core/DisTubeBase.js.map +1 -0
  14. package/dist/core/DisTubeHandler.d.ts +84 -0
  15. package/dist/core/DisTubeHandler.d.ts.map +1 -0
  16. package/dist/core/DisTubeHandler.js +311 -0
  17. package/dist/core/DisTubeHandler.js.map +1 -0
  18. package/dist/core/DisTubeOptions.d.ts +26 -0
  19. package/dist/core/DisTubeOptions.d.ts.map +1 -0
  20. package/dist/core/DisTubeOptions.js +93 -0
  21. package/dist/core/DisTubeOptions.js.map +1 -0
  22. package/dist/core/DisTubeStream.d.ts +52 -0
  23. package/dist/core/DisTubeStream.d.ts.map +1 -0
  24. package/dist/core/DisTubeStream.js +109 -0
  25. package/dist/core/DisTubeStream.js.map +1 -0
  26. package/dist/core/index.d.ts +7 -0
  27. package/dist/core/index.d.ts.map +1 -0
  28. package/dist/core/index.js +19 -0
  29. package/dist/core/index.js.map +1 -0
  30. package/dist/core/manager/BaseManager.d.ts +18 -0
  31. package/dist/core/manager/BaseManager.d.ts.map +1 -0
  32. package/dist/core/manager/BaseManager.js +44 -0
  33. package/dist/core/manager/BaseManager.js.map +1 -0
  34. package/dist/core/manager/QueueManager.d.ts +60 -0
  35. package/dist/core/manager/QueueManager.d.ts.map +1 -0
  36. package/dist/core/manager/QueueManager.js +202 -0
  37. package/dist/core/manager/QueueManager.js.map +1 -0
  38. package/dist/core/manager/index.d.ts +3 -0
  39. package/dist/core/manager/index.d.ts.map +1 -0
  40. package/dist/core/manager/index.js +15 -0
  41. package/dist/core/manager/index.js.map +1 -0
  42. package/dist/core/voice/DJSAdapter.d.ts +4 -0
  43. package/dist/core/voice/DJSAdapter.d.ts.map +1 -0
  44. package/dist/core/voice/DJSAdapter.js +61 -0
  45. package/dist/core/voice/DJSAdapter.js.map +1 -0
  46. package/dist/core/voice/DisTubeVoice.d.ts +83 -0
  47. package/dist/core/voice/DisTubeVoice.d.ts.map +1 -0
  48. package/dist/core/voice/DisTubeVoice.js +236 -0
  49. package/dist/core/voice/DisTubeVoice.js.map +1 -0
  50. package/dist/core/voice/DisTubeVoiceManager.d.ts +41 -0
  51. package/dist/core/voice/DisTubeVoiceManager.d.ts.map +1 -0
  52. package/dist/core/voice/DisTubeVoiceManager.js +67 -0
  53. package/dist/core/voice/DisTubeVoiceManager.js.map +1 -0
  54. package/dist/core/voice/index.d.ts +4 -0
  55. package/dist/core/voice/index.d.ts.map +1 -0
  56. package/dist/core/voice/index.js +16 -0
  57. package/dist/core/voice/index.js.map +1 -0
  58. package/dist/index.d.ts +8 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +23 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/plugin/http.d.ts +8 -0
  63. package/dist/plugin/http.d.ts.map +1 -0
  64. package/dist/plugin/http.js +20 -0
  65. package/dist/plugin/http.js.map +1 -0
  66. package/dist/plugin/https.d.ts +14 -0
  67. package/dist/plugin/https.d.ts.map +1 -0
  68. package/dist/plugin/https.js +50 -0
  69. package/dist/plugin/https.js.map +1 -0
  70. package/dist/plugin/index.d.ts +4 -0
  71. package/dist/plugin/index.d.ts.map +1 -0
  72. package/dist/plugin/index.js +16 -0
  73. package/dist/plugin/index.js.map +1 -0
  74. package/dist/plugin/youtube-dl.d.ts +11 -0
  75. package/dist/plugin/youtube-dl.d.ts.map +1 -0
  76. package/dist/plugin/youtube-dl.js +75 -0
  77. package/dist/plugin/youtube-dl.js.map +1 -0
  78. package/dist/struct/CustomPlugin.d.ts +27 -0
  79. package/dist/struct/CustomPlugin.d.ts.map +1 -0
  80. package/dist/struct/CustomPlugin.js +35 -0
  81. package/dist/struct/CustomPlugin.js.map +1 -0
  82. package/dist/struct/DisTubeError.d.ts +54 -0
  83. package/dist/struct/DisTubeError.d.ts.map +1 -0
  84. package/dist/struct/DisTubeError.js +72 -0
  85. package/dist/struct/DisTubeError.js.map +1 -0
  86. package/dist/struct/ExtractorPlugin.d.ts +29 -0
  87. package/dist/struct/ExtractorPlugin.d.ts.map +1 -0
  88. package/dist/struct/ExtractorPlugin.js +32 -0
  89. package/dist/struct/ExtractorPlugin.js.map +1 -0
  90. package/dist/struct/Playlist.d.ts +42 -0
  91. package/dist/struct/Playlist.d.ts.map +1 -0
  92. package/dist/struct/Playlist.js +104 -0
  93. package/dist/struct/Playlist.js.map +1 -0
  94. package/dist/struct/Plugin.d.ts +82 -0
  95. package/dist/struct/Plugin.d.ts.map +1 -0
  96. package/dist/struct/Plugin.js +108 -0
  97. package/dist/struct/Plugin.js.map +1 -0
  98. package/dist/struct/Queue.d.ts +217 -0
  99. package/dist/struct/Queue.d.ts.map +1 -0
  100. package/dist/struct/Queue.js +480 -0
  101. package/dist/struct/Queue.js.map +1 -0
  102. package/dist/struct/SearchResult.d.ts +28 -0
  103. package/dist/struct/SearchResult.d.ts.map +1 -0
  104. package/dist/struct/SearchResult.js +79 -0
  105. package/dist/struct/SearchResult.js.map +1 -0
  106. package/dist/struct/Song.d.ts +68 -0
  107. package/dist/struct/Song.d.ts.map +1 -0
  108. package/dist/struct/Song.js +229 -0
  109. package/dist/struct/Song.js.map +1 -0
  110. package/dist/struct/TaskQueue.d.ts +33 -0
  111. package/dist/struct/TaskQueue.d.ts.map +1 -0
  112. package/dist/struct/TaskQueue.js +58 -0
  113. package/dist/struct/TaskQueue.js.map +1 -0
  114. package/dist/struct/index.d.ts +10 -0
  115. package/dist/struct/index.d.ts.map +1 -0
  116. package/dist/struct/index.js +22 -0
  117. package/dist/struct/index.js.map +1 -0
  118. package/dist/tsconfig.tsbuildinfo +1 -0
  119. package/dist/type.d.ts +159 -0
  120. package/dist/type.d.ts.map +1 -0
  121. package/dist/type.js +3 -0
  122. package/dist/type.js.map +1 -0
  123. package/dist/util.d.ts +47 -0
  124. package/dist/util.d.ts.map +1 -0
  125. package/dist/util.js +205 -0
  126. package/dist/util.js.map +1 -0
  127. package/package.json +50 -24
  128. package/src/DisTube.js +0 -1121
  129. package/src/Playlist.js +0 -107
  130. package/src/Queue.js +0 -120
  131. package/src/SearchResult.js +0 -81
  132. package/src/Song.js +0 -135
  133. package/src/duration.js +0 -39
  134. package/typings/DisTube.d.ts +0 -635
  135. package/typings/Playlist.d.ts +0 -73
  136. package/typings/Queue.d.ts +0 -106
  137. package/typings/SearchResult.d.ts +0 -59
  138. package/typings/Song.d.ts +0 -104
  139. package/typings/duration.d.ts +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisTube.js","sourceRoot":"","sources":["../src/DisTube.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiC;AACjC,yDAAiC;AACjC,iCAA6C;AAC7C,2DAAkD;AAClD,wBAiBW;AAIX;;;GAGG;AACH,MAAa,OAAQ,SAAQ,iCAA2B;IAStD;;;;;;;;;;;;OAYG;IACH,YAAY,MAAc,EAAE,MAAsB,EAAE;QAClD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,IAAA,mBAAgB,EAAC,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,IAAA,mBAAY,EAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7B;;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IAAI,CAAC,OAAO,IAAI,CAAC,IAAA,wBAAqB,EAAC,OAAO,CAAC,EAAE;YAC/C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;SACzE;aAAM,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YACzC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;SACpC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CACV,6IAA6I,CAC9I,CAAC;SACH;IACH,CAAC;CAEF;AA7mBD,0BA6mBC;AAED,kBAAe,OAAO,CAAC;AAEvB;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;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/stable/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"]}
@@ -0,0 +1,130 @@
1
+ import type { Filters } from ".";
2
+ /**
3
+ * Default DisTube audio filters.
4
+ * @typedef {Object} defaultFilters
5
+ * @prop {string} 3d 3d
6
+ * @prop {string} bassboost bassboost
7
+ * @prop {string} echo echo
8
+ * @prop {string} karaoke karaoke
9
+ * @prop {string} nightcore nightcore
10
+ * @prop {string} vaporwave vaporwave
11
+ * @prop {string} flanger flanger
12
+ * @prop {string} gate gate
13
+ * @prop {string} haas haas
14
+ * @prop {string} reverse reverse
15
+ * @prop {string} surround surround
16
+ * @prop {string} mcompand mcompand
17
+ * @prop {string} phaser phaser
18
+ * @prop {string} tremolo tremolo
19
+ * @prop {string} earwax earwax
20
+ */
21
+ export declare const defaultFilters: Filters;
22
+ /**
23
+ * DisTube options.
24
+ * @typedef {Object} DisTubeOptions
25
+ * @prop {Array<CustomPlugin|ExtractorPlugin>} [plugins] DisTube plugins.
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.
30
+ * @prop {boolean} [leaveOnFinish=false] Whether or not leaving voice channel when the queue ends.
31
+ * @prop {boolean} [leaveOnStop=true] Whether or not leaving voice channel after using {@link DisTube#stop} function.
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".
40
+ * @prop {boolean} [youtubeDL=true] Whether or not using youtube-dl.
41
+ * @prop {boolean} [updateYouTubeDL=true] Whether or not updating youtube-dl automatically.
42
+ * @prop {Filters} [customFilters] Override {@link defaultFilters} or add more ffmpeg filters.
43
+ * Example=`{ "Filter name"="Filter value"; "8d"="apulsator=hz=0.075" }`
44
+ * @prop {ytdl.getInfoOptions} [ytdlOptions] `ytdl-core` get info options
45
+ * @prop {number} [searchCooldown=60] Built-in search cooldown in seconds (When searchSongs is bigger than 0)
46
+ * @prop {number} [emptyCooldown=60] Built-in leave on empty cooldown in seconds (When leaveOnEmpty is true)
47
+ * @prop {boolean} [nsfw=false] Whether or not playing age-restricted content
48
+ * and disabling safe search in non-NSFW channel.
49
+ * @prop {boolean} [emitAddListWhenCreatingQueue=true] Whether or not emitting `addList` event when creating a new Queue
50
+ * @prop {boolean} [emitAddSongWhenCreatingQueue=true] Whether or not emitting `addSong` event when creating a new Queue
51
+ */
52
+ export declare const defaultOptions: {
53
+ plugins: never[];
54
+ emitNewSongOnly: boolean;
55
+ leaveOnEmpty: boolean;
56
+ leaveOnFinish: boolean;
57
+ leaveOnStop: boolean;
58
+ savePreviousSongs: boolean;
59
+ youtubeDL: boolean;
60
+ updateYouTubeDL: boolean;
61
+ searchSongs: number;
62
+ customFilters: {};
63
+ ytdlOptions: {};
64
+ searchCooldown: number;
65
+ emptyCooldown: number;
66
+ nsfw: boolean;
67
+ emitAddSongWhenCreatingQueue: boolean;
68
+ emitAddListWhenCreatingQueue: boolean;
69
+ };
70
+ /**
71
+ * Data that can be resolved to give a guild ID string. This can be:
72
+ * - A guild ID string | a guild {@link https://discord.js.org/#/docs/main/master/class/Snowflake|Snowflake}
73
+ * - A {@link https://discord.js.org/#/docs/main/master/class/Guild|Guild}
74
+ * - A {@link https://discord.js.org/#/docs/main/master/class/Message|Message}
75
+ * - A {@link https://discord.js.org/#/docs/main/master/class/TextChannel|TextChannel}
76
+ * - A {@link https://discord.js.org/#/docs/main/master/class/VoiceChannel|VoiceChannel}
77
+ * - A {@link https://discord.js.org/#/docs/main/master/class/StageChannel|StageChannel}
78
+ * - A {@link https://discord.js.org/#/docs/main/master/class/VoiceState|VoiceState}
79
+ * - A {@link https://discord.js.org/#/docs/main/master/class/GuildMember|GuildMember}
80
+ * - A {@link https://discord.js.org/#/docs/main/master/class/Interaction|Interaction}
81
+ * - A {@link Queue}
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
96
+ */
97
+ /**
98
+ * FFmpeg Filters
99
+ * ```
100
+ * {
101
+ * "Filter Name": "Filter Value",
102
+ * "bassboost": "bass=g=10"
103
+ * }
104
+ * ```
105
+ * @typedef {Object.<string, string>} Filters
106
+ * @see {@link defaultFilters}
107
+ */
108
+ /**
109
+ * The repeat mode of a {@link Queue} (enum)
110
+ * * `DISABLED` = 0
111
+ * * `SONG` = 1
112
+ * * `QUEUE` = 2
113
+ * @typedef {number} RepeatMode
114
+ */
115
+ export declare enum RepeatMode {
116
+ DISABLED = 0,
117
+ SONG = 1,
118
+ QUEUE = 2
119
+ }
120
+ /**
121
+ * All available plugin types:
122
+ * * `custom`: {@link CustomPlugin}
123
+ * * `extractor`: {@link ExtractorPlugin}
124
+ * @typedef {"custom"|"extractor"} PluginType
125
+ */
126
+ export declare enum PluginType {
127
+ CUSTOM = "custom",
128
+ EXTRACTOR = "extractor"
129
+ }
130
+ //# sourceMappingURL=constant.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAED;;;;;GAKG;AACH,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginType = exports.RepeatMode = exports.defaultOptions = exports.defaultFilters = void 0;
4
+ /**
5
+ * Default DisTube audio filters.
6
+ * @typedef {Object} defaultFilters
7
+ * @prop {string} 3d 3d
8
+ * @prop {string} bassboost bassboost
9
+ * @prop {string} echo echo
10
+ * @prop {string} karaoke karaoke
11
+ * @prop {string} nightcore nightcore
12
+ * @prop {string} vaporwave vaporwave
13
+ * @prop {string} flanger flanger
14
+ * @prop {string} gate gate
15
+ * @prop {string} haas haas
16
+ * @prop {string} reverse reverse
17
+ * @prop {string} surround surround
18
+ * @prop {string} mcompand mcompand
19
+ * @prop {string} phaser phaser
20
+ * @prop {string} tremolo tremolo
21
+ * @prop {string} earwax earwax
22
+ */
23
+ exports.defaultFilters = {
24
+ "3d": "apulsator=hz=0.125",
25
+ bassboost: "bass=g=10",
26
+ echo: "aecho=0.8:0.9:1000:0.3",
27
+ flanger: "flanger",
28
+ gate: "agate",
29
+ haas: "haas",
30
+ karaoke: "stereotools=mlev=0.1",
31
+ nightcore: "asetrate=48000*1.25,aresample=48000,bass=g=5",
32
+ reverse: "areverse",
33
+ vaporwave: "asetrate=48000*0.8,aresample=48000,atempo=1.1",
34
+ mcompand: "mcompand",
35
+ phaser: "aphaser",
36
+ tremolo: "tremolo",
37
+ surround: "surround",
38
+ earwax: "earwax",
39
+ };
40
+ /**
41
+ * DisTube options.
42
+ * @typedef {Object} DisTubeOptions
43
+ * @prop {Array<CustomPlugin|ExtractorPlugin>} [plugins] DisTube plugins.
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.
48
+ * @prop {boolean} [leaveOnFinish=false] Whether or not leaving voice channel when the queue ends.
49
+ * @prop {boolean} [leaveOnStop=true] Whether or not leaving voice channel after using {@link DisTube#stop} function.
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".
58
+ * @prop {boolean} [youtubeDL=true] Whether or not using youtube-dl.
59
+ * @prop {boolean} [updateYouTubeDL=true] Whether or not updating youtube-dl automatically.
60
+ * @prop {Filters} [customFilters] Override {@link defaultFilters} or add more ffmpeg filters.
61
+ * Example=`{ "Filter name"="Filter value"; "8d"="apulsator=hz=0.075" }`
62
+ * @prop {ytdl.getInfoOptions} [ytdlOptions] `ytdl-core` get info options
63
+ * @prop {number} [searchCooldown=60] Built-in search cooldown in seconds (When searchSongs is bigger than 0)
64
+ * @prop {number} [emptyCooldown=60] Built-in leave on empty cooldown in seconds (When leaveOnEmpty is true)
65
+ * @prop {boolean} [nsfw=false] Whether or not playing age-restricted content
66
+ * and disabling safe search in non-NSFW channel.
67
+ * @prop {boolean} [emitAddListWhenCreatingQueue=true] Whether or not emitting `addList` event when creating a new Queue
68
+ * @prop {boolean} [emitAddSongWhenCreatingQueue=true] Whether or not emitting `addSong` event when creating a new Queue
69
+ */
70
+ exports.defaultOptions = {
71
+ plugins: [],
72
+ emitNewSongOnly: false,
73
+ leaveOnEmpty: true,
74
+ leaveOnFinish: false,
75
+ leaveOnStop: true,
76
+ savePreviousSongs: true,
77
+ youtubeDL: true,
78
+ updateYouTubeDL: true,
79
+ searchSongs: 0,
80
+ customFilters: {},
81
+ ytdlOptions: {},
82
+ searchCooldown: 60,
83
+ emptyCooldown: 60,
84
+ nsfw: false,
85
+ emitAddSongWhenCreatingQueue: true,
86
+ emitAddListWhenCreatingQueue: true,
87
+ };
88
+ /**
89
+ * Data that can be resolved to give a guild ID string. This can be:
90
+ * - A guild ID string | a guild {@link https://discord.js.org/#/docs/main/master/class/Snowflake|Snowflake}
91
+ * - A {@link https://discord.js.org/#/docs/main/master/class/Guild|Guild}
92
+ * - A {@link https://discord.js.org/#/docs/main/master/class/Message|Message}
93
+ * - A {@link https://discord.js.org/#/docs/main/master/class/TextChannel|TextChannel}
94
+ * - A {@link https://discord.js.org/#/docs/main/master/class/VoiceChannel|VoiceChannel}
95
+ * - A {@link https://discord.js.org/#/docs/main/master/class/StageChannel|StageChannel}
96
+ * - A {@link https://discord.js.org/#/docs/main/master/class/VoiceState|VoiceState}
97
+ * - A {@link https://discord.js.org/#/docs/main/master/class/GuildMember|GuildMember}
98
+ * - A {@link https://discord.js.org/#/docs/main/master/class/Interaction|Interaction}
99
+ * - A {@link Queue}
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
114
+ */
115
+ /**
116
+ * FFmpeg Filters
117
+ * ```
118
+ * {
119
+ * "Filter Name": "Filter Value",
120
+ * "bassboost": "bass=g=10"
121
+ * }
122
+ * ```
123
+ * @typedef {Object.<string, string>} Filters
124
+ * @see {@link defaultFilters}
125
+ */
126
+ /**
127
+ * The repeat mode of a {@link Queue} (enum)
128
+ * * `DISABLED` = 0
129
+ * * `SONG` = 1
130
+ * * `QUEUE` = 2
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 = {}));
139
+ /**
140
+ * All available plugin types:
141
+ * * `custom`: {@link CustomPlugin}
142
+ * * `extractor`: {@link ExtractorPlugin}
143
+ * @typedef {"custom"|"extractor"} PluginType
144
+ */
145
+ var PluginType;
146
+ (function (PluginType) {
147
+ PluginType["CUSTOM"] = "custom";
148
+ PluginType["EXTRACTOR"] = "extractor";
149
+ })(PluginType = exports.PluginType || (exports.PluginType = {}));
150
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAED;;;;;GAKG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,qCAAuB,CAAA;AACzB,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB","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` = 0\n * * `SONG` = 1\n * * `QUEUE` = 2\n * @typedef {number} RepeatMode\n */\nexport enum RepeatMode {\n DISABLED,\n SONG,\n QUEUE,\n}\n\n/**\n * All available plugin types:\n * * `custom`: {@link CustomPlugin}\n * * `extractor`: {@link ExtractorPlugin}\n * @typedef {\"custom\"|\"extractor\"} PluginType\n */\nexport enum PluginType {\n CUSTOM = \"custom\",\n EXTRACTOR = \"extractor\",\n}\n"]}
@@ -0,0 +1,55 @@
1
+ import type { Client, TextChannel } from "discord.js";
2
+ import type { DisTube, DisTubeEvents, DisTubeHandler, DisTubeVoiceManager, Options, QueueManager } from "..";
3
+ /**
4
+ * @private
5
+ * @abstract
6
+ */
7
+ export declare abstract class DisTubeBase {
8
+ distube: DisTube;
9
+ constructor(distube: DisTube);
10
+ /**
11
+ * Emit the {@link DisTube} of this base
12
+ * @param {string} eventName Event name
13
+ * @param {...any} args arguments
14
+ * @returns {boolean}
15
+ */
16
+ emit(eventName: keyof DisTubeEvents, ...args: any): boolean;
17
+ /**
18
+ * Emit error event
19
+ * @param {Error} error error
20
+ * @param {Discord.TextChannel?} channel Text channel where the error is encountered.
21
+ */
22
+ emitError(error: Error, channel?: TextChannel): void;
23
+ /**
24
+ * The queue manager
25
+ * @type {QueueManager}
26
+ * @readonly
27
+ */
28
+ get queues(): QueueManager;
29
+ /**
30
+ * The voice manager
31
+ * @type {DisTubeVoiceManager}
32
+ * @readonly
33
+ */
34
+ get voices(): DisTubeVoiceManager;
35
+ /**
36
+ * Discord.js client
37
+ * @type {Discord.Client}
38
+ * @readonly
39
+ */
40
+ get client(): Client;
41
+ /**
42
+ * DisTube options
43
+ * @type {DisTubeOptions}
44
+ * @readonly
45
+ */
46
+ get options(): Options;
47
+ /**
48
+ * DisTube handler
49
+ * @type {DisTubeHandler}
50
+ * @readonly
51
+ */
52
+ get handler(): DisTubeHandler;
53
+ }
54
+ export default DisTubeBase;
55
+ //# sourceMappingURL=DisTubeBase.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DisTubeBase = void 0;
4
+ /**
5
+ * @private
6
+ * @abstract
7
+ */
8
+ class DisTubeBase {
9
+ constructor(distube) {
10
+ /**
11
+ * DisTube
12
+ * @type {DisTube}
13
+ */
14
+ this.distube = distube;
15
+ }
16
+ /**
17
+ * Emit the {@link DisTube} of this base
18
+ * @param {string} eventName Event name
19
+ * @param {...any} args arguments
20
+ * @returns {boolean}
21
+ */
22
+ emit(eventName, ...args) {
23
+ return this.distube.emit(eventName, ...args);
24
+ }
25
+ /**
26
+ * Emit error event
27
+ * @param {Error} error error
28
+ * @param {Discord.TextChannel?} channel Text channel where the error is encountered.
29
+ */
30
+ emitError(error, channel) {
31
+ this.distube.emitError(error, channel);
32
+ }
33
+ /**
34
+ * The queue manager
35
+ * @type {QueueManager}
36
+ * @readonly
37
+ */
38
+ get queues() {
39
+ return this.distube.queues;
40
+ }
41
+ /**
42
+ * The voice manager
43
+ * @type {DisTubeVoiceManager}
44
+ * @readonly
45
+ */
46
+ get voices() {
47
+ return this.distube.voices;
48
+ }
49
+ /**
50
+ * Discord.js client
51
+ * @type {Discord.Client}
52
+ * @readonly
53
+ */
54
+ get client() {
55
+ return this.distube.client;
56
+ }
57
+ /**
58
+ * DisTube options
59
+ * @type {DisTubeOptions}
60
+ * @readonly
61
+ */
62
+ get options() {
63
+ return this.distube.options;
64
+ }
65
+ /**
66
+ * DisTube handler
67
+ * @type {DisTubeHandler}
68
+ * @readonly
69
+ */
70
+ get handler() {
71
+ return this.distube.handler;
72
+ }
73
+ }
74
+ exports.DisTubeBase = DisTubeBase;
75
+ exports.default = DisTubeBase;
76
+ //# sourceMappingURL=DisTubeBase.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,84 @@
1
+ import ytdl from "@distube/ytdl-core";
2
+ import { DisTubeBase, DisTubeStream } from ".";
3
+ import { Playlist, Queue, SearchResult, Song } from "..";
4
+ import type { DisTube, OtherSongInfo } from "..";
5
+ import type { GuildMember, Message, StageChannel, TextChannel, VoiceChannel } from "discord.js";
6
+ /**
7
+ * DisTube's Handler
8
+ * @extends DisTubeBase
9
+ * @private
10
+ */
11
+ export declare class DisTubeHandler extends DisTubeBase {
12
+ ytdlOptions: ytdl.downloadOptions;
13
+ constructor(distube: DisTube);
14
+ /**
15
+ * Create a new guild queue
16
+ * @param {Discord.Message|Discord.VoiceChannel|Discord.StageChannel} message A user message | a voice channel
17
+ * @param {Song|Song[]} song Song to play
18
+ * @param {Discord.TextChannel} textChannel A text channel of the queue
19
+ * @throws {Error}
20
+ * @returns {Promise<Queue|true>} `true` if queue is not generated
21
+ */
22
+ createQueue(message: Message | VoiceChannel | StageChannel, song: Song | Song[], textChannel?: TextChannel): Promise<Queue | true>;
23
+ /**
24
+ * @param {string} url url
25
+ * @param {boolean} [basic=false] getBasicInfo?
26
+ * @returns {Promise<ytdl.videoInfo>}
27
+ */
28
+ getYouTubeInfo(url: string, basic?: boolean): Promise<ytdl.videoInfo>;
29
+ /**
30
+ * Resolve a Song
31
+ * @param {Discord.GuildMember} member Requested user
32
+ * @param {string|Song|SearchResult|Playlist} song URL | Search string | {@link Song}
33
+ * @returns {Promise<Song|Playlist|null>} Resolved
34
+ */
35
+ resolveSong(member: GuildMember, song: string | ytdl.videoInfo | Song | Playlist | SearchResult | OtherSongInfo | ytdl.relatedVideo | null): Promise<Song | Playlist | null>;
36
+ /**
37
+ * Resole Song[] or url to a Playlist
38
+ * @param {Discord.GuildMember} member Requested user
39
+ * @param {Song[]|string} playlist Resolvable playlist
40
+ * @param {string} [source="youtube"] Playlist source
41
+ * @returns {Promise<Playlist>}
42
+ */
43
+ resolvePlaylist(member: GuildMember, playlist: Playlist | Song[] | string, source?: string): Promise<Playlist>;
44
+ /**
45
+ * Create a custom playlist
46
+ * @returns {Promise<Playlist>}
47
+ * @param {Discord.Message|Discord.GuildMember} message A message from guild channel | A guild member
48
+ * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult
49
+ * @param {Object} [properties={}] Additional properties such as `name`
50
+ * @param {boolean} [parallel=true] Whether or not fetch the songs in parallel
51
+ * @example
52
+ * const songs = ["https://www.youtube.com/watch?v=xxx", "https://www.youtube.com/watch?v=yyy"];
53
+ * const playlist = await distube.handler.createCustomPlaylist(member, songs, { name: "My playlist name" }, true);
54
+ * // Or fetching custom playlist sequentially (reduce lag for low specs)
55
+ * const playlist = await distube.handler.createCustomPlaylist(member, songs, false);
56
+ * distube.playVoiceChannel(voiceChannel, playlist, { ... });
57
+ */
58
+ createCustomPlaylist(message: Message | GuildMember, songs: (string | Song | SearchResult)[], properties?: any, parallel?: boolean): Promise<Playlist>;
59
+ /**
60
+ * Play / add a playlist
61
+ * @returns {Promise<void>}
62
+ * @param {Discord.Message|Discord.VoiceChannel|Discord.StageChannel} message A message | a voice channel
63
+ * @param {Playlist|string} playlist A YouTube playlist url | a Playlist
64
+ * @param {Discord.TextChannel|boolean} [textChannel] The default text channel of the queue
65
+ * @param {boolean} [skip=false] Skip the playing song (if exists) and play the added playlist instantly
66
+ * @param {boolean} [unshift=false] Add the playlist to the beginning of the queue (after the playing song if exists)
67
+ */
68
+ handlePlaylist(message: Message | VoiceChannel | StageChannel, playlist: Playlist, textChannel?: TextChannel, skip?: boolean, unshift?: boolean): Promise<void>;
69
+ /**
70
+ * Search for a song, fire {@link DisTube#event:error} if not found.
71
+ * @param {Discord.Message} message A message from guild channel
72
+ * @param {string} query The query string
73
+ * @returns {Promise<SearchResult?>} Song info
74
+ */
75
+ searchSong(message: Message, query: string): Promise<SearchResult | null>;
76
+ /**
77
+ * Create a ytdl stream
78
+ * @param {Queue} queue Queue
79
+ * @returns {DisTubeStream}
80
+ */
81
+ createStream(queue: Queue): DisTubeStream;
82
+ }
83
+ export default DisTubeHandler;
84
+ //# sourceMappingURL=DisTubeHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisTubeHandler.d.ts","sourceRoot":"","sources":["../../src/core/DisTubeHandler.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAC/C,OAAO,EAEL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,IAAI,EAKL,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEhG;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC;gBACtB,OAAO,EAAE,OAAO;IA+C5B;;;;;;;OAOG;IACG,WAAW,CACf,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,YAAY,EAC9C,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,EACnB,WAAW,GAAE,WAAyD,GACrE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAOxB;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CA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