DisTubeHandler
DisTube’s Handler
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DisTubeHandler(distube): DisTubeHandler;Create a new base object.
Parameters
Section titled “Parameters”distube
Section titled “distube”The DisTube instance
Returns
Section titled “Returns”DisTubeHandler
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”distube
Section titled “distube”distube: DisTube;The DisTube instance this object belongs to.
Inherited from
Section titled “Inherited from”Accessors
Section titled “Accessors”client
Section titled “client”Get Signature
Section titled “Get Signature”get client(): Client;Discord.js client
Returns
Section titled “Returns”Client
Inherited from
Section titled “Inherited from”handler
Section titled “handler”Get Signature
Section titled “Get Signature”get handler(): DisTubeHandler;DisTube handler
Returns
Section titled “Returns”DisTubeHandler
Inherited from
Section titled “Inherited from”options
Section titled “options”Get Signature
Section titled “Get Signature”get options(): Options;DisTube options
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”plugins
Section titled “plugins”Get Signature
Section titled “Get Signature”get plugins(): DisTubePlugin[];DisTube plugins
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”queues
Section titled “queues”Get Signature
Section titled “Get Signature”get queues(): QueueManager;The queue manager
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”voices
Section titled “voices”Get Signature
Section titled “Get Signature”get voices(): DisTubeVoiceManager;The voice manager
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”_getPluginFromSong()
Section titled “_getPluginFromSong()”Call Signature
Section titled “Call Signature”_getPluginFromSong(song): Promise< | DisTubePlugin| null>;Find the plugin that can handle the given song.
Parameters
Section titled “Parameters”The song
Returns
Section titled “Returns”Promise<
| DisTubePlugin
| null>
The plugin, or null when there is none
Call Signature
Section titled “Call Signature”_getPluginFromSong<T>( song, types, validate?): Promise<DisTubePlugin & { type: T; } | null>;Find the plugin of the given type that can handle the given song.
Type Parameters
Section titled “Type Parameters”T extends PluginType
Parameters
Section titled “Parameters”The song
T[]
The types of the plugin to look for
validate?
Section titled “validate?”boolean
Whether the url of the song has to be validated
Returns
Section titled “Returns”Promise<DisTubePlugin & { type: T; } | null>
The plugin, or null when there is none
_getPluginFromURL()
Section titled “_getPluginFromURL()”_getPluginFromURL(url): Promise< | DisTubePlugin| null>;Find the plugin that supports the given url.
Parameters
Section titled “Parameters”string
The url to check
Returns
Section titled “Returns”Promise<
| DisTubePlugin
| null>
The plugin, or null when there is none
attachStreamInfo()
Section titled “attachStreamInfo()”attachStreamInfo(song): Promise<void>;Get Song’s stream info and attach it to the song.
Parameters
Section titled “Parameters”A Song
Returns
Section titled “Returns”Promise<void>
A promise that resolves when the stream info is attached
Throws
Section titled “Throws”DisTubeError When no plugin supports the song, or when its stream URL cannot be found
debug()
Section titled “debug()”debug(message): void;Emit debug event
Parameters
Section titled “Parameters”message
Section titled “message”string
debug message
Returns
Section titled “Returns”void
Nothing
Inherited from
Section titled “Inherited from”emit()
Section titled “emit()”emit(eventName, ...args): boolean;Emit the DisTube of this base
Parameters
Section titled “Parameters”eventName
Section titled “eventName”keyof DisTubeEvents
Event name
…any
arguments
Returns
Section titled “Returns”boolean
true when the event had listeners, false otherwise
Inherited from
Section titled “Inherited from”emitError()
Section titled “emitError()”emitError( error, queue, song?): void;Emit error event
Parameters
Section titled “Parameters”Error
error
The queue encountered the error
Song<unknown>
The playing song when encountered the error
Returns
Section titled “Returns”void
Nothing
Inherited from
Section titled “Inherited from”followRedirectLink()
Section titled “followRedirectLink()”followRedirectLink(url, maxRedirect?): Promise<string>;Follow the redirections of an url.
Parameters
Section titled “Parameters”string
The url to follow
maxRedirect?
Section titled “maxRedirect?”number = MAX_REDIRECT_DEPTH
The maximum number of redirections to follow
Returns
Section titled “Returns”Promise<string>
The final url
resolve()
Section titled “resolve()”Resolve a url or a supported object to a Song or Playlist
Throws
Section titled “Throws”input
Resolvable input
options
Optional options
Call Signature
Section titled “Call Signature”resolve<T>(song, options?): Promise<Song<T>>;Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”Song<T>
The song to resolve
options?
Section titled “options?”Omit<ResolveOptions<unknown>, "metadata">
Optional options
Returns
Section titled “Returns”Promise<Song<T>>
The resolved song
Call Signature
Section titled “Call Signature”resolve<T>(song, options?): Promise<Playlist<T>>;Resolve a Playlist to a Playlist.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”Playlist<T>
The playlist to resolve
options?
Section titled “options?”Omit<ResolveOptions<unknown>, "metadata">
Optional options
Returns
Section titled “Returns”Promise<Playlist<T>>
The resolved playlist
Call Signature
Section titled “Call Signature”resolve<T>(song, options?): Promise< | Song<T>| Playlist<T>>;Resolve a url or a search query to a Song or a Playlist.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”string
The url or the search query to resolve
options?
Section titled “options?”Optional options
Returns
Section titled “Returns”Promise<
| Song<T>
| Playlist<T>>
The resolved song or playlist
Call Signature
Section titled “Call Signature”resolve<T>(song, options): Promise<Song<T>>;Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”The song to resolve
options
Section titled “options”Optional options
Returns
Section titled “Returns”Promise<Song<T>>
The resolved song
Call Signature
Section titled “Call Signature”resolve<T>(song, options): Promise<Playlist<T>>;Resolve a Playlist to a Playlist.
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”The playlist to resolve
options
Section titled “options”Optional options
Returns
Section titled “Returns”Promise<Playlist<T>>
The resolved playlist
Call Signature
Section titled “Call Signature”resolve(song, options?): Promise< | Song<unknown>| Playlist<unknown>>;Resolve a url or a supported object to a Song or Playlist
Parameters
Section titled “Parameters”| string
| Song<unknown>
| Playlist<unknown>
Resolvable input
options?
Section titled “options?”ResolveOptions<unknown>
Optional options
Returns
Section titled “Returns”Promise<
| Song<unknown>
| Playlist<unknown>>
Resolved
Throws
Section titled “Throws”Example
Section titled “Example”const song = await distube.handler.resolve("Never gonna give you up");