disrexom
Version:
A Discord.js module to simplify your music commands and play songs with audio filters on Discord without any API key. Support YouTube, SoundCloud, Bandcamp, Facebook, and 700+ more sites
84 lines • 4.43 kB
TypeScript
import ytdl from "@distube/ytdl-core";
import { DisTubeBase, DisTubeStream } from ".";
import { Playlist, Queue, SearchResult, Song } from "..";
import type { DisTube, OtherSongInfo } from "..";
import type { GuildMember, Message, StageChannel, TextChannel, VoiceChannel } from "discord.js";
/**
* DisTube's Handler
* @extends DisTubeBase
* @private
*/
export declare class DisTubeHandler extends DisTubeBase {
ytdlOptions: ytdl.downloadOptions;
constructor(distube: DisTube);
/**
* Create a new guild queue
* @param {Discord.Message|Discord.VoiceChannel|Discord.StageChannel} message A user message | a voice channel
* @param {Song|Song[]} song Song to play
* @param {Discord.TextChannel} textChannel A text channel of the queue
* @throws {Error}
* @returns {Promise<Queue|true>} `true` if queue is not generated
*/
createQueue(message: Message | VoiceChannel | StageChannel, song: Song | Song[], textChannel?: TextChannel): Promise<Queue | true>;
/**
* @param {string} url url
* @param {boolean} [basic=false] getBasicInfo?
* @returns {Promise<ytdl.videoInfo>}
*/
getYouTubeInfo(url: string, basic?: boolean): Promise<ytdl.videoInfo>;
/**
* Resolve a Song
* @param {Discord.GuildMember} member Requested user
* @param {string|Song|SearchResult|Playlist} song URL | Search string | {@link Song}
* @returns {Promise<Song|Playlist|null>} Resolved
*/
resolveSong(member: GuildMember, song: string | ytdl.videoInfo | Song | Playlist | SearchResult | OtherSongInfo | ytdl.relatedVideo | null): Promise<Song | Playlist | null>;
/**
* Resole Song[] or url to a Playlist
* @param {Discord.GuildMember} member Requested user
* @param {Song[]|string} playlist Resolvable playlist
* @param {string} [source="youtube"] Playlist source
* @returns {Promise<Playlist>}
*/
resolvePlaylist(member: GuildMember, playlist: Playlist | Song[] | string, source?: string): Promise<Playlist>;
/**
* Create a custom playlist
* @returns {Promise<Playlist>}
* @param {Discord.Message|Discord.GuildMember} message A message from guild channel | A guild member
* @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult
* @param {Object} [properties={}] Additional properties such as `name`
* @param {boolean} [parallel=true] Whether or not fetch the songs in parallel
* @example
* const songs = ["https://www.youtube.com/watch?v=xxx", "https://www.youtube.com/watch?v=yyy"];
* const playlist = await distube.handler.createCustomPlaylist(member, songs, { name: "My playlist name" }, true);
* // Or fetching custom playlist sequentially (reduce lag for low specs)
* const playlist = await distube.handler.createCustomPlaylist(member, songs, false);
* distube.playVoiceChannel(voiceChannel, playlist, { ... });
*/
createCustomPlaylist(message: Message | GuildMember, songs: (string | Song | SearchResult)[], properties?: any, parallel?: boolean): Promise<Playlist>;
/**
* Play / add a playlist
* @returns {Promise<void>}
* @param {Discord.Message|Discord.VoiceChannel|Discord.StageChannel} message A message | a voice channel
* @param {Playlist|string} playlist A YouTube playlist url | a Playlist
* @param {Discord.TextChannel|boolean} [textChannel] The default text channel of the queue
* @param {boolean} [skip=false] Skip the playing song (if exists) and play the added playlist instantly
* @param {boolean} [unshift=false] Add the playlist to the beginning of the queue (after the playing song if exists)
*/
handlePlaylist(message: Message | VoiceChannel | StageChannel, playlist: Playlist, textChannel?: TextChannel, skip?: boolean, unshift?: boolean): Promise<void>;
/**
* Search for a song, fire {@link DisTube#event:error} if not found.
* @param {Discord.Message} message A message from guild channel
* @param {string} query The query string
* @returns {Promise<SearchResult?>} Song info
*/
searchSong(message: Message, query: string): Promise<SearchResult | null>;
/**
* Create a ytdl stream
* @param {Queue} queue Queue
* @returns {DisTubeStream}
*/
createStream(queue: Queue): DisTubeStream;
}
export default DisTubeHandler;
//# sourceMappingURL=DisTubeHandler.d.ts.map