trackmania.player module

class trackmania.player.Player(club_tag: str | None, first_login: datetime.datetime | None, player_id: str, last_club_tag_change: str, meta: PlayerMetaInfo, name: str, trophies: Optional[PlayerTrophies] = None, zone: Optional[List[PlayerZone]] = None, m3v3_data: Optional[PlayerMatchmaking] = None, royal_data: Optional[PlayerMatchmaking] = None)[source]

Bases: object

New in version 0.1.0.

Represents a Player in Trackmania

Parameters
  • club_tag (str | None.) – The club tag of the player, NoneType if the player is not in a club.

  • first_login (datetime | None) – The date of the first login of the player.

  • player_id (str) – The Trackmania ID of the player.

  • last_club_tag_change (str) – The date of the last club tag change of the player.

  • login (str) – Login of the player.

  • meta (PlayerMetaInfo.) – Meta data of the player.

  • name (str) – Name of the player.

  • trophies (PlayerTrophies, optional) – The trophies of the player.

  • zone (List[PlayerZone], optional) – The zone of the player as a list.

  • m3v3_data (PlayerMatchmaking, optional) – The 3v3 data of the player.

  • royal_data (PlayerMatchmaking, optional) – The royal data of the player.

property first_login

first login property.

async static get_id(username: str) str[source]

New in version 0.1.0.

New in version 0.3.4: Updated to work with the change in search function

Gets a player’s id from the given username

Parameters

username (str) – The player’s username to get the ID for.

Returns

The player’s id.

Return type

str

async classmethod get_player(player_id: str) Self[source]

New in version 0.1.0.

Gets a player’s data from their player_id

Parameters

player_id (str) – The player id of the player

async static get_username(player_id: str) str[source]

New in version 0.1.0.

Gets a player’s username from their player id

Parameters

player_id (str) – The player id of the player

Returns

The player’s username

Return type

str

property player_id

player id property.

async static search(username: str) Optional[List[PlayerSearchResult]][source]

New in version 0.1.0.

Changed in version 0.3.4: The function no longer returns a single PlayerSearchResult. It will now always return a list or None

Searches for a player’s information using their username.

Parameters

username (str) – The player’s username to search for

Returns

Returns a list of PlayerSearchResult with users who have similar usernames. Returns None if no user with that username can be found.

Return type

List[PlayerSearchResult] | None

class trackmania.player.PlayerMatchmaking(matchmaking_type: str, type_id: int, progression: int, rank: int, score: int, division: int, min_points: int, max_points: int, player_id: Optional[str] = None)[source]

Bases: object

New in version 0.1.0.

Class that represents the player matchmaking details

Parameters
  • matchmaking_type (str) – The type of matchmaking, either “3v3” or “Royal”

  • type_id (int) – The type of matchmaking as 0 or 1, 0 for “3v3” and 1 for “Royal”

  • progression (int) – The progression of the player’s score in matchmaking

  • rank (int) – The rank of the player in matchmaking

  • score (int) – The score of the player in matchmaking

  • division (int) – The division of the player in matchmaking

  • division_str (str: str) – The division of the player in matchmaking as a string

  • min_points (int) – The points required to reach the current division.

  • max_points (int) – The points required to move up the rank.

  • player_id (str | None) – The player’s ID. Defaults to None

async history(page: int = 0) List[PlayerMatchmakingResult][source]

New in version 0.3.0.

Changed in version 0.4.0: Use _get_history() helper command.

History of recent matches in this matchmaking

Parameters

page (int, optional) – The page number, by default 0

Returns

The list of matchmaking results

Return type

List[PlayerMatchmakingResult]

Raises

InvalidIDError – If the player_id is not set.

property max_points

max points

property min_points

min points

async static top_matchmaking(page: int = 0, royal: bool = False) List[Dict][source]

New in version 0.3.0.

Top matchmaking players

Parameters
  • page (int, optional) – The page number, by default 0

  • royal (bool, optional) – Whether to get the top matchmaking players for royal, by default False

Returns

The top matchmaking players by score. Each page contains 50 players.

Return type

List[Dict]

class trackmania.player.PlayerMetaInfo(display_url: str, in_nadeo: bool, in_tmgl: bool, in_tmio_dev_team: bool, is_sponsor: bool, sponsor_level: int | None, twitch: str | None, twitter: str | None, youtube: str | None, vanity: str | None)[source]

Bases: object

New in version 0.1.0.

Represents Player Meta Data, which inclues YT, Twitch, Twitter or TMIO Vanity Link

Parameters
  • display_url (str) – The URL to the player’s profile

  • in_nadeo (bool) – Whether the player is in Nadeo

  • in_tmgl (bool) – Whether the player is in TMGL

  • in_tmio_dev_team (bool) – Whether the player is in TMIO Dev Team

  • is_sponsor (bool) – Whether the player is a sponsor

  • sponsor_level (int | None) – The sponsor level of the player

  • twitch (str | None) – The Twitch URL of the player, NoneType if the player has no Twitch

  • twitter (str | None) – The Twitter URL of the player, NoneType if the player has no Twitter

  • youtube (str | None) – The YouTube URL of the player, NoneType if the player has no YouTube

  • vanity (str | None) – The TMIO Vanity URL of the player, NoneType if the player has no TMIO Vanity URL

class trackmania.player.PlayerSearchResult(club_tag: str | None, name: str, player_id: str, zone: List[PlayerZone], threes: trackmania.matchmaking.PlayerMatchmaking | None, royal: trackmania.matchmaking.PlayerMatchmaking | None)[source]

Bases: object

New in version 0.1.0.

Represents 1 Player from a Search Result

Parameters
  • club_tag (str | None.) – The club tag of the player, NoneType if the player is not in a club.

  • name (str) – Name of the player.

  • player_id (str) – The Trackmania ID of the player.

  • zone (List[PlayerZone], optional) – The zone of the player as a list.

  • threes (PlayerMatchmaking, optional) – The 3v3 data of the player.

  • royals (PlayerMatchmaking, optional) – The royal data of the player.

class trackmania.player.PlayerZone(flag: str, zone: str, rank: int)[source]

Bases: object

New in version 0.1.0.

Class that represents the player zone

Parameters
  • flag (str) – The flag of the zone

  • zone (str) – The zone name

  • rank (int) – The rank of the player in the zone

static to_string(player_zones: Optional[List[Self]], add_pos: bool = True, inline: bool = False) str | None[source]

New in version 0.4.0.

Prints a list of zones in a readable format.

Parameters
  • player_zones (List[Self]) – The list of PlayerZone objects.

  • add_pos (bool) –

    New in version 0.4.0.

    Whether to add the position of the zone.

  • inline (bool) –

    New in version 0.4.0.

    Whether to print the zones in a single line.

Returns

The list of zones in a readable format.

Return type

str