Plugin events should implement this interface to use with Player#onPluginEvent
Example with LavaLyrics LyricsLineEvent event
LyricsLineEvent
export class LyricsLineEvent implements PluginEvent { public readonly pluginRequired = { name: 'lavalyrics-plugin', version: '^1.1.0' }; public readonly name = 'LyricsLineEvent'; public readonly T = t<{ lineIndex: number; line: { timestamp: number; duration?: number; line: string; plugin: unknown; }; skipped: boolean; }>; } Copy
export class LyricsLineEvent implements PluginEvent { public readonly pluginRequired = { name: 'lavalyrics-plugin', version: '^1.1.0' }; public readonly name = 'LyricsLineEvent'; public readonly T = t<{ lineIndex: number; line: { timestamp: number; duration?: number; line: string; plugin: unknown; }; skipped: boolean; }>; }
Readonly
Name of event
Optional
Plugin required by event
This hack is to work around TypeScript types not existing at runtime. We can specify the return type here.
This function is never actually called, so the implementation can be simply:
T = (response: unknown) => response as LavalinkResponse; Copy
T = (response: unknown) => response as LavalinkResponse;
Or using the t utility function
t
import { t } from 'shoukaku';T = t<LavalinkResponse>; Copy
import { t } from 'shoukaku';T = t<LavalinkResponse>;
Plugin events should implement this interface to use with Player#onPluginEvent
Example
Example with LavaLyrics
LyricsLineEventevent