Interface PlayerRequestOptions

The options for a player API request

interface PlayerRequestOptions {
    allowCache?: boolean;
    apiKey?: string;
    cacheFor?: number;
    forceCaseMatch?: boolean;
    forceUUIDLookup?: boolean;
    ignoreVersion?: boolean;
    multipleChoicesSelector?: ((v, i, a) => boolean | Promise<boolean>);
    player: string;
    priority?: boolean;
    retries?: number;
    timeout?: number;
}

Hierarchy

Properties

allowCache?: boolean

Whether to allow this request to use the cache or ongoing requests if available

Requests using cache or other requests do not count towards the ratelimit and return a lot faster.
apiKey?: string

The API key to use in this request

The key has to be registered in the config.
If this is not given, the registered key with the most free requests will be selected.
cacheFor?: number

The amount of time the request should be cached for, overwrites the defaults specified in the config

forceCaseMatch?: boolean

Whether player should be case-sensitive instead; ignored if player is a UUID

Default

false

Deprecated

As of v3.1.0, this option has no effect.

forceUUIDLookup?: boolean

Whether to force a UUID lookup before the player request. This can help reduce some errors caused by name changes. Ignored if player is a UUID

Default

false

Deprecated

As of v3.1.0, this option has no effect.

ignoreVersion?: boolean

Whether to ignore version errors

You can use this to resolve temporary conflicts while the library awaits being updated. Otherwise it should stay enabled.

Default

false
multipleChoicesSelector?: ((v, i, a) => boolean | Promise<boolean>)

Type declaration

    • (v, i, a): boolean | Promise<boolean>
    • A function that will be executed with each of the choices as a parameter. It may return a Promise of a boolean. In that case, the selector will be executed for all values simultaneously. And the passing element with the lowest index will be selected. If the selector returns false for all choices, the error is thrown regardless

      Parameters

      Returns boolean | Promise<boolean>

      True, if the given choice should be selected

player: string

A player UUID or name; case-insensitive

priority?: boolean

Whether this request should be put to the front of the queue, executing before any non-priority requests are handled

Default

false
retries?: number

The amount of times to retry the request on error

timeout?: number

The amount of milliseconds a until the request should be rejected

Be aware that each retry has it's own timeout, meaning 30,000 ms of timeout may lead to a 90,000 ms wait until a request is rejected on 2 retries.

Generated using TypeDoc