Player
Player is the main way to interact with the laserforce api.
Example of getting basic player information from a player ID:
import laserforce
import asyncio
async def main():
player = await laserforce.Player.from_id("4-43-1265")
print(player) # laserforce.Player
print(player.codename) # The player's codename
print(player.join_date) # The date the player joined
print(player.total_mission_count) # The total number of missions the player has played across all sites
print(player.total_score) # The total score the player has achieved
print(player.avatar_image_link) # The link to the player's avatar image
asyncio.run(main())
Player
- class laserforce.Player(id: str | List[int], sites: List[laserforce.objects.site.Site], codename: str, avatar: int, join_date: datetime.datetime, total_mission_count: int)[source]
- async static from_id(player_id: str | List[int]) Player[source]
Get a player object from their ID.
- Parameters:
player_id (PlayerId) – The ID of the player to get. This can be a string or a list of integers. Example: “4-43-1265” or [4, 43, 1265].
- Returns:
A Player object with the player’s details.
- Return type:
- property avatar_image_link: str
Get the link to the player’s avatar image.
- Returns:
The URL of the player’s avatar image.
- Return type:
- async recent_missions() List[Mission][source]
Get the recent missions of this player.
- Returns:
A list of Mission objects for the player.
- Return type:
List[Mission]
- async achievements(site: str | Site | None = None) List[Achievement][source]
Get the achievements of this player.
- Parameters:
site (Optional[Union[str, Site]]) – The site to get achievements for. If None, the global achievements will be returned.
- Returns:
A list of Achievement objects for the specified site or global achievements.
- Return type:
List[Achievement]