berconpy.Player

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

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

client

The client that created this object.

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.

is_guid_valid

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

in_lobby

Whether the player is in the server lobby or not.

ping

The player's ping on the server.

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

Bans the player from the server using their GUID.

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

Bans the player from the server using their IP.

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) – An optional reason to display when kicking the player.

async send(message)

Sends a message to the player.

Parameters:

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

addr: str

The IP address and port this player connected from.

client: AsyncRCONClient

The client that created this object.

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 client’s fetch_players() method since it cannot be determined during connection.

is_guid_valid: bool

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

name: str

The player’s name.

property ping: int

The player’s ping on the server.

This information is only updated after an AsyncRCONClient.fetch_players() call and defaults to -1 if it is never called. However, by default, the client automatically calls fetch_players() on login and then periodically during the connection’s lifetime.