trackmania.campaign module
- class trackmania.campaign.Campaign(campaign_id: int, club_id: int, image: str, is_official: bool, leaderboard_uid: str, maps: list[trackmania.tmmap.TMMap], map_count: int, media: trackmania.campaign.OfficialCampaignMedia | None, name: str)[source]
Bases:
CampaignObjectNew in version 0.5.
Represents a Campaign in Trackmania 2020.
- Parameters
campaign_id (int) – The campaign’s ID
club_id (int) – The club’s id.
image (str | None) – The image URL of the campaign. Returns the decal image if this is an official campaign. NoneType if there is no decal image.
is_official (bool) – Whether the camapaign is official (made by Nadeo).
leaderboard_uid (str) – The campaign’s leaderboard id.
maps (
list[TMMap]) – The maps in the campaign.map_count (int) – The number of maps in the campaign.
media (
OfficialCampaignMedia| None) – The media of the campaign only if it is on official campaign.name (str) – The name of the campaign
- async club() Club[source]
New in version 0.5.
The club the Campaign belongs to.
- Returns
The Club the campaign belongs to. If it does not belong to a campaign returns None.
- Return type
Club| None
- async classmethod current_season() Self[source]
New in version 0.5.
Gets the current seasonal campaign.
- Returns
The campaign.
- Return type
- async classmethod get_campaign(campaign_id: int, club_id: int) Optional[Self][source]
New in version 0.5.
Gets a campaign with the given campaign and club ids. If it’s an official campaign, the club_id should be = 0
- Parameters
campaign_id (int) – The campaign’s id.
club_id (int) – The club the campaign belongs to. = 0 if the campaign is an official nadeo campaign.
- Returns
The campaign object, None if it does not exist
- Return type
Campaign| None
- get_map(index: int = 0) TMMap[source]
New in version 0.5.
Gets a map at a specific index.
- Parameters
index (int, optional) – The index of the map requested, by default 0
- Returns
The map at the index.
- Return type
TMMap
- async leaderboards(offset: int = 0, length: int = 100) list[trackmania.campaign.CampaignLeaderboard][source]
New in version 0.5.
Gets the points leaderboards for the campaign.
- Parameters
offset (int, optional) – The leaderboard offset to start at, by default 0
length (int, optional) – The length of the leaderboard to get. Can only be between 0 and 100, by default 100
- Returns
The leaderboard of the campaign based on points.
- Return type
list[CampaignLeaderboard]
- async static official_campaigns() list[trackmania.campaign.CampaignSearchResult][source]
New in version 0.5.
Gets all official nadeo campaigns.
- Returns
The list of campaigns.
- Return type
list[CampaignSearchResult]
- async static popular_campaigns(page: int = 0) list[trackmania.campaign.CampaignSearchResult][source]
New in version 0.5.
Gets all popular campaigns, official campaigns excluded. 50 Results / Page (except Page 1 because of the official campaigns)
- Parameters
page (int, optional) – The page number, by default 0
- Returns
The list of campaigns.
- Return type
list[CampaignSearchResult]
- class trackmania.campaign.CampaignLeaderboard(player_name: str, player_id: str, player_tag: str | None, position: int, points: int)[source]
Bases:
CampaignObjectNew in version 0.5.
Represents a player on the Campaign’s point leaderboards
- Parameters
player_name (str) – The name of the player who got the position.
player_id (str) – The ID of the player who got the position.
player_tag (str | None) – The tag of the player who got the position.
position (int) – The position the player achieved.
points (int) – The points the player has
- class trackmania.campaign.CampaignSearchResult(club_id: int, date: datetime, campaign_id: int, map_count: int, name: int)[source]
Bases:
CampaignObjectNew in version 0.5.
Represents a CampaignSearchResult.
- Parameters
club_id (int) – The ID of the club that created the campaign.
date (datetime) – The date the campaign was created.
campaign_id (int) – The ID of the campaign.
map_count (int) – The number of maps in the campaign.
name (str) – The name of the campaign.
- class trackmania.campaign.OfficialCampaignMedia(button_background: Optional[str] = None, button_foreground: Optional[str] = None, decal: Optional[str] = None, live_button_background: Optional[str] = None, live_button_foreground: Optional[str] = None, popup: Optional[str] = None, popup_background: Optional[str] = None)[source]
Bases:
CampaignObjectNew in version 0.5.
Media images of official campaigns
- Parameters
button_background (str | None) – The button background image URL of the campaign.
button_foreground (str | None) – The button foreground image URL of the campaign.
decal (str | None) – The decal image URL of the campaign
live_button_background (str | None) – The live button background image URL of the campaign.
live_button_foreground (str | None) – The live button foreground image URL of the campaign.
popup (str | None) – The popup image URL of the campaign.
popup_background (str | None) – The popup background image URL of the campaign.