Shoukaku
    Preparing search index...

    Class GetPlayerEndpoint

    Routes should implement this interface to use with fetch function

    Properties can be a value, or a function that returns a value to access this

    Example with LavaSearch /loadsearch endpoint

    	export class LoadSearchEndpoint implements RestEndpoint {
    constructor(public readonly query: string, public readonly types: string) {}

    public readonly pluginRequired = {
    name: 'lavasearch-plugin',
    version: '^1.0.0'
    };

    public readonly endpoint = '/loadsearch';
    public readonly params = () => ({ query: this.query, types: this.types });

    public readonly T = t<{
    tracks?: Track[];
    albums?: Playlist[];
    artists?: Playlist[];
    playlists?: Playlist[];
    texts?: {
    text: string;
    plugin: Record<string, unknown>;
    };
    plugin: Record<string, unknown>;
    }>;
    }

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    guildId: string
    sessionId: string
    T: (type: unknown) => LavalinkPlayer = ...

    This hack is to work around TypeScript types not existing at runtime. We can specify the return type here.

    Type Declaration

      • (type: unknown): LavalinkPlayer
      • Internal

        Utility for specifying types in generic interfaces, workaround for TypeScript types not existing at runtime

        Parameters

        • type: unknown

        Returns LavalinkPlayer

    This function is never actually called, so the implementation can be simply:

    T = (response: unknown) => response as LavalinkResponse;
    

    Or using the t utility function

    import { t } from 'shoukaku';

    T = t<LavalinkResponse>;

    Methods

    • Returns string