berconpy.Player

class berconpy.Player(cache, id, name, guid, addr, ping, is_guid_valid, in_lobby)

Bases: object

Represents a player in the server.

Methods

ban_guid([duration, reason])

Bans the player from the server using their GUID.

ban_ip([duration, reason])

Bans the player from the server using their IP.

is_connected()

Checks if the player is still in the client's cache.

kick([reason])

Kicks the player from the server.

send(message)

Sends a message to the player.

Attributes

id

The ID assigned to this player by the server.

name

The player's name.

guid

The player's GUID.

addr

The IP address and port this player connected from.

ping

The player's ping on the server.

is_guid_valid

Whether the server has confirmed the validity of this player's GUID.

in_lobby

Whether the player is in the server lobby or not.

cache

The cache that created this object.

client

Returns the client associated with the cache.

ip

Returns the IP address of the player.

async ban_guid(duration=None, reason='')

Bans the player from the server using their GUID.

Parameters:
  • duration (Optional[int]) – How long the player should be banned. Can be None to indicate a permanent ban.

  • reason (str) – The reason to display when the player is banned.

Return type:

str

Returns:

The response from the server, if any.

async ban_ip(duration=None, reason='')

Bans the player from the server using their IP.

Parameters:
  • duration (Optional[int]) – How long the player should be banned. Can be None to indicate a permanent ban.

  • reason (str) – The reason to display when the player is banned.

Return type:

str

Returns:

The response from the server, if any.

is_connected()

Checks if the player is still in the client’s cache.

Return type:

bool

async kick(reason='')

Kicks the player from the server.

Parameters:

reason (str) – The reason to display when kicking the player.

Return type:

str

Returns:

The response from the server, if any.

async send(message)

Sends a message to the player.

Parameters:

message (str) – The string to use as the message.

Return type:

str

Returns:

The response from the server, if any.

addr: str

The IP address and port this player connected from.

property cache: ArmaCache

The cache that created this object.

property client: ArmaClient | None

Returns the client associated with the cache.

guid: str

The player’s GUID. This may be an empty string if the client has not yet received the GUID from the server.

id: int

The ID assigned to this player by the server.

in_lobby: bool

Whether the player is in the server lobby or not.

This data is only accurate after calling the ArmaClient.fetch_players() method since it cannot be determined during connection.

property ip: str

Returns the IP address of the player.

This property is derived from addr.

is_guid_valid: bool

Whether the server has confirmed the validity of this player’s GUID.

name: str

The player’s name.

ping: int | None

The player’s ping on the server.

This data may not be available or may be out-of-date since it is only provided when the ArmaClient.fetch_players() is called.