Skip to content

Plugin

A media provider, an engine, or both. Data types the pluginData slot of every Song it returns, and ListData that of every Playlist.

A plugin has name and at least one of resolve, search, stream or engine. Core only passes Songs whose source is this plugin’s name. A thrown DisTubeError reaches the caller unchanged, except that INVALID_ARGUMENT, INVALID_STATE and ABORTED without a caller abort become SOURCE_FAILED with the original as cause. Any other throw becomes SOURCE_FAILED with source set to name.

Type Parameter Default type
Data unknown
ListData unknown
Property Type Description
engine? Engine Replaces the Adapter’s built-in engine. At most one configured plugin carries one.
name string -

optional dispose(): void | Promise<void>

void | Promise<void>


optional related(song, options): Promise<Song<Data> | undefined>

Autoplay continuation, or undefined to decline.

Parameter Type
song Song<Data>
options RelatedOptions

Promise<Song<Data> | undefined>


optional resolve(url, options): Promise<Song<Data> | Playlist<Data, ListData> | undefined>

Resolves a URL the plugin owns, or declines with undefined.

Parameter Type
url string
options ResolveOptions

Promise<Song<Data> | Playlist<Data, ListData> | undefined>


optional search(query, options): Promise<readonly Song<Data>[]>

Provider-ranked results. An empty array declines.

Parameter Type
query string
options SearchOptions

Promise<readonly Song<Data>[]>


optional stream(song, options): Promise<PlaybackResource>

A fresh resource for an owned Song. Without it, and without an engine prepare, core searches every other plugin that has search and stream for the Song’s name and artist and plays the first candidate that prepares.

Parameter Type
song Song<Data>
options { signal: AbortSignal; }
options.signal AbortSignal

Promise<PlaybackResource>


optional suggest(query, options): Promise<readonly string[]>

Completions for a partial query, at most 25 used.

Parameter Type
query string
options { signal: AbortSignal; }
options.signal AbortSignal

Promise<readonly string[]>