Class Player

Represents a DDNet player.

const coolGuy = await Player.new('Sans3108');

console.log(coolGuy.favoriteServer); // "GER"
console.log(coolGuy.globalLeaderboard.completionist.points); // 2727

Properties

activity: ActivityEntry[]

Recorded player activity.

All maps stats for this player.

favoritePartners: Partner[]

Favorite partners of this player.

favoriteServer: ServerRegion

The favorite server region of this player.

finishes: Finishes

First and recent finishes for this player.

Does not include rank information for any finishes, values are set to -1.

globalLeaderboard: GlobalLeaderboard

Global leaderboard stats for this player.

hoursPlayedPast365days: number

Number of hours played in the past 365 days by this player.

name: string

The name of this player.

serverTypes: Servers

Server stats leaderboards for this player.

totalCompletionistPoints: number

Total amount of points earnable from first completions across all maps.

url: string

The url of this player on ddnet.org

clearCache: (() => Promise<void>) = ...

Clears the Player.cache.

Type declaration

    • (): Promise<void>
    • Clears the CacheManager.store.

      Returns Promise<void>

setTTL: ((ttlMS?: number) => void) = ...

Sets the TTL (Time-To-Live) for objects in cache.

Type declaration

    • (ttlMS?): void
    • Sets the CacheManager.ttl.

      Parameters

      • OptionalttlMS: number

        If provided, sets the CacheManager.ttl to this value, otherwise uses the default value.

      Returns void

Methods

  • Returns an array of objects containing the names of all finished maps and a function to turn them into proper Map objects.

    Parameters

    • force: boolean = false

      Wether to bypass the cache.

    • OptionalrankSource: null | RankAvailableRegion

      The region to pull ranks from in the toMap function from the returned value. Omit for global ranks.

    Returns Promise<{
        name: string;
        toMap: (() => Promise<Map>);
    }[]>

  • Search for a player.

    Parameters

    • value: string

      The value to search for.

    • force: boolean = false

      Wether to bypass the cache.

    Returns Promise<null | {
        name: string;
        points: number;
        toPlayer: (() => Promise<Player>);
    }[]>