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.
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
The client that created this object.
The ID assigned to this player by the server.
The player's name.
The player's GUID.
The IP address and port this player connected from.
Whether the server confirmed the validity of this player's GUID.
Whether the player is in the server lobby or not.
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.
- 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.
-
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.
-
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.
- property ping: int¶
The player’s ping on the server.
This information is only updated after an
AsyncRCONClient.fetch_players()call and defaults to-1if it is never called. However, by default, the client automatically calls fetch_players() on login and then periodically during the connection’s lifetime.