Documentation
Classes
discord-player
BaseExtractor

BaseExtractor

new BaseExtractor(context)
ParameterTypeOptionalDescription
contextExtractorExecutionContextContext that instantiated this extractor

Properties

public context: ExtractorExecutionContext

Context that instantiated this extractor

public static identifier: string

Identifier for this extractor

public identifier: string

Identifier of this extractor

Methods

public activate(): Promise<void>

This method will be executed when this extractor is activated

public createResponse(playlist?, tracks): ExtractorInfo

Create extractor response

ParameterTypeOptionalDescription
playlistnull | PlaylistThe playlist
tracksArray<Track>The track array

public deactivate(): Promise<void>

This method will be executed when this extractor is deactivated

public debug(message): boolean

Write debug message

ParameterTypeOptionalDescription
messagestringThe debug message

public emit(event, args): boolean

Dispatch an event to the player

ParameterTypeOptionalDescription
eventKThe event to dispatch
argsParameters<PlayerEvents[K]>The data to dispatch

public handle(query, context): Promise<ExtractorInfo>

Handle the given query

ParameterTypeOptionalDescription
querystringThe query to handle
contextExtractorSearchContext-

public handlePostStream(stream, next): void

A stream middleware to handle streams before passing it to the player

ParameterTypeOptionalDescription
streamReadableThe incoming stream
nextNextFunctionThe next function

public stream(info): Promise<string | Readable>

Stream the given track

ParameterTypeOptionalDescription
infoTrackThe track to stream

public validate(query, type?): Promise<boolean>

Validate incoming query

ParameterTypeOptionalDescription
querystringThe query to validate
typenull | SearchQueryType-