client

Only the most essential features to dota2.client.Dota2Client are found here. Every other feature is inherited from the dota2.features package and it’s submodules.

class dota2.client.Dota2Client(steam_client)

Bases: steam.client.gc.GameCoordinator, dota2.features.FeatureBase

Parameters:steam_client (steam.client.SteamClient) – Instance of the steam client
verbose_debug = False

enable pretty print of messages in debug logging

app_id = 570

main client app id

ready = False

True when we have a session with GC

connection_status = 2

dota2.enums.GCConnectionStatus

account_id

Account ID of the logged in user in the steam client

steam_id

steam.steamid.SteamID of the logged-in user in the steam client

wait_msg(event, timeout=None, raises=None)

Wait for a message, similiar to wait_event()

Parameters:
  • eventEDOTAGCMsg or job id
  • timeout (int) – seconds to wait before timeout
  • raises (bool) – On timeout when False returns None, else raise gevent.Timeout
Returns:

returns a message or None

Return type:

None, or proto message

Raises:

``gevent.Timeout`

send_job(*args, **kwargs)

Send a message as a job

Exactly the same as send()

Returns:jobid event identifier
Return type:str
send_job_and_wait(emsg, data={}, proto=None, timeout=None, raises=False)

Send a message as a job and wait for the response.

Note

Not all messages are jobs, you’ll have to find out which are which

Parameters:
  • emsg – Enum for the message
  • data (dict) – data for the proto message
  • proto – (optional) specify protobuf, otherwise it’s detected based on emsg
  • timeout (int) – (optional) seconds to wait
  • raises (bool) – (optional) On timeout if this is False method will return None, else raises gevent.Timeout
Returns:

response proto message

Raises:

gevent.Timeout`

send(emsg, data={}, proto=None)

Send a message

Parameters:
  • emsg – Enum for the message
  • data (dict) – data for the proto message
  • proto – (optional) manually specify protobuf, other it’s detected based on emsg
launch()

Launch Dota 2 and establish connection with the game coordinator

ready event will fire when the session is ready. If the session is lost notready event will fire. Alternatively, connection_status event can be monitored for changes.

exit()

Close connection to Dota 2’s game coordinator

sleep(seconds)

Yeild and sleep N seconds. Allows other greenlets to run

idle()

Yeild in the current greenlet and let other greenlets run