trackmania.tmmap module

class trackmania.tmmap.Leaderboard(timestamp: datetime, ghost: str, player_club_tag: str | None, player_name: str | None, player_id: str | None, position: int, time: int)[source]

Bases: object

New in version 0.3.0.

Represents the Map’s Leaderboard

Parameters
  • timestamp (datetime) – The timestamp of the leaderboard was achieved

  • ghost (str) – The url for the ghost download

  • player_club_tag (str | None) – The player’s club tag

  • player_name (str) – The player’s name

  • player_id (str) –

    New in version 0.3.4.

    The player’s id

  • position (int) – The position of the player in the leaderboard

  • time (int) – The time of the player in the leaderboard

async get_player() Player[source]

New in version 0.3.4.

Gets the player who achieved the leaderboard.

Returns

The player obj, None if the player_id does not exist.

Return type

Player

class trackmania.tmmap.MedalTimes(bronze: int, silver: int, gold: int, author: int)[source]

Bases: object

New in version 0.3.0.

Represents a map’s medal times

Parameters
  • bronze (int) – The bronze medal time in ms

  • silver (int) – The silver medal time in ms

  • gold (int) – The gold medal time in ms

  • author (int) – The author of the medal times

  • bronze_string (str) – The bronze medal time in mm:ss:msmsms format

  • silver_string (str) – The silver medal time in mm:ss:msmsms format

  • gold_string (str) – The gold medal time in mm:ss:msmsms format

  • author_string (str) – The author of the medal times in mm:ss:msmsms format

class trackmania.tmmap.TMMap(author_id: str, author_name: str, environment: str, exchange_id: str | None, file_name: str, map_id: str, leaderboard: Optional[List[Leaderboard]], medal_time: MedalTimes, name: str, submitter_id: str, submitter_name: str, thumbnail: str, uid: str, uploaded: datetime, url: str)[source]

Bases: object

New in version 0.3.0.

Represents a Trackmania Map

Parameters
  • author_id (str) – The author’s player id

  • environment (str) – The environment of the map

  • exchange_id (str | None) – The exchange id of the map

  • file_name (str) – The file name of the map

  • map_id (str) – The map id of the map

  • leaderboard (List[Leaderboard] | None) – The leaderboard of the map

  • medal_times (MedalTimes) – The medal times of the map

  • name (str) – The name of the map

  • submitter_id (str) – The map’s submitter’s id

  • thumbnail (str) – Link to the thumbnail of the map

  • uid (str) – The uid of the map

  • uploaded (datetime) – The timestamp of when the map was uploaded

  • url (str) – The url of the map download

  • lb_loaded (bool) – Whether the leaderboard has been loaded

async author() Player[source]

New in version 0.3.0.

Returns the author as a player.

Returns

The author as a Player object

Return type

Player

async get_leaderboard(offset: int = 0, length: int = 100) List[Leaderboard][source]

New in version 0.3.0.

Get’s the leaderboard of a map.

Parameters
  • offset (int, optional) – The offset of the leaderboard. Defaults to 0.

  • length (int, optional) – How many leaderpositions to get. Should be between 1 and 100 both inclusive. by default 100

Returns

The leaderboard as a list of positions.

Return type

List[Leaderboard]

Raises

ValueError – If the length is not between 1 and 100.

async classmethod get_map(map_uid: str) Self[source]

New in version 0.3.0.

Gets the TM Map from the Map’s UID

Parameters

map_uid (str) – The map’s UID

property lb_loaded
async load_more_leaderboard(length: int = 100) List[Leaderboard][source]

New in version 0.3.0.

Gets more leaderboards for the map. If get_leaderboards wasn’t used before then it just gets it from the start.

Parameters

length (int, optional) – How many leaderboard positions to get, by default 100

Returns

The leaderboard positions.

Return type

List[Leaderboard]

property offset
async submitter() Player[source]

New in version 0.3.0.

Returns the submitter as a player.

Returns

The submitter as a Player object

Return type

Player