ValvePython / dota2

🐸 Python package for interacting with Dota 2 Game Coordinator
http://dota2.readthedocs.io
198 stars 32 forks source link

Can not send party invite #50

Closed simonsk90 closed 3 years ago

simonsk90 commented 4 years ago

First of all, sorry for asking this here. I am a python noob, and this is probably just me doing something wrong. I have a hard time getting started with this project, and I don't know where else to ask for advice. Here is my issue:

I am trying to send a party invitation, but nothing just ever happens. An invitation is never received at the receiving end. Here is my code:

from steam import SteamClient
from dota2 import Dota2Client
import logging

logging.basicConfig(format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG)

client = SteamClient()
dota = Dota2Client(client)

@client.on('logged_on')
def start_dota():
    dota.launch()

@dota.on('ready')
def invite_gimlee():
    print("Inviting gimlee")
    steamId64 = 123456789
    jobid = dota.invite_to_party(steamId64)
    resp = dota.wait_event(jobid, timeout=10)

client.cli_login()
client.run_forever()

And here is the output log, which I have a hard time understanding. Because to me it seems like nothing is going wrong?

[2020-02-14 18:58:21,056] DEBUG Dota2Client: Incoming: <EGCBaseClientMsg.EMsgGCClientWelcome: 4004>
[2020-02-14 18:58:21,056] DEBUG Dota2Client: Emit event: <EGCBaseClientMsg.EMsgGCClientWelcome: 4004>
[2020-02-14 18:58:21,056] DEBUG Dota2Client.socache: Emit event: ('new', <ESOType.CSODOTAGameAccountClient: 2002>)
[2020-02-14 18:58:21,057] DEBUG Dota2Client.socache: Emit event: ('new', <ESOType.CSODOTAGameAccountPlus: 2012>)
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: 'connection_status'
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: 'ready'
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Got DOTAWelcome
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: 'dota_welcome'
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Incoming: <EGCItemMsg.EMsgGCToClientItemAges: 2591>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: <EGCItemMsg.EMsgGCToClientItemAges: 2591>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCTopCustomGamesList: 8024>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCTopCustomGamesList: 8024>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCToClientMatchGroupsVersion: 8075>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCToClientMatchGroupsVersion: 8075>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgDOTAWeekendTourneySchedule: 7465>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgDOTAWeekendTourneySchedule: 7465>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCToClientChatRegionsEnabled: 8067>
[2020-02-14 18:58:21,057] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCToClientChatRegionsEnabled: 8067>
Inviting gimlee
[2020-02-14 18:58:21,058] DEBUG Dota2Client: Outgoing: <EGCBaseMsg.EMsgGCInviteToParty: 4501>
[2020-02-14 18:58:21,058] DEBUG SteamClient: Outgoing: <MsgProto <EMsg.ClientToGC: 5452>>
[2020-02-14 18:58:21,549] DEBUG SteamClient: Incoming: <MsgProto <EMsg.Multi: 1>>
[2020-02-14 18:58:21,549] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2020-02-14 18:58:21,549] DEBUG SteamClient: Multi: Unpacking
[2020-02-14 18:58:21,549] DEBUG SteamClient: Incoming: <MsgProto <EMsg.ClientFromGC: 5453>>
[2020-02-14 18:58:21,549] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2020-02-14 18:58:21,549] ERROR Dota2Client: Failed to parse: 7681
[2020-02-14 18:58:21,738] DEBUG SteamClient: Incoming: <MsgProto <EMsg.Multi: 1>>
[2020-02-14 18:58:21,738] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2020-02-14 18:58:21,738] DEBUG SteamClient: Multi: Unpacking
[2020-02-14 18:58:21,738] DEBUG SteamClient: Multi: Decompressing payload (190 -> 216)
[2020-02-14 18:58:21,738] DEBUG SteamClient: Incoming: <MsgProto <EMsg.ClientFromGC: 5453>>
[2020-02-14 18:58:21,738] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2020-02-14 18:58:21,739] DEBUG SteamClient: Incoming: <MsgProto <EMsg.ClientFromGC: 5453>>
[2020-02-14 18:58:21,739] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Incoming: <ESOMsg.CacheSubscribed: 24>
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Emit event: <ESOMsg.CacheSubscribed: 24>
[2020-02-14 18:58:21,739] DEBUG Dota2Client.socache: Emit event: ('new', <ESOType.CSODOTAParty: 2003>)
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Emit event: 'new_party'
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Incoming: <EGCBaseMsg.EMsgGCInvitationCreated: 4502>
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Emit event: <EGCBaseMsg.EMsgGCInvitationCreated: 4502>
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Emit event: 'invitation_created'
[2020-02-14 18:58:24,047] DEBUG SteamClient: Outgoing: <MsgProto <EMsg.ClientHeartBeat: 703>>
[2020-02-14 18:58:33,055] DEBUG SteamClient: Outgoing: <MsgProto <EMsg.ClientHeartBeat: 703>>
[2020-02-14 18:58:42,063] DEBUG SteamClient: Outgoing: <MsgProto <EMsg.ClientHeartBeat: 703>>
[2020-02-14 18:58:48,586] DEBUG SteamClient: Incoming: <MsgProto <EMsg.Multi: 1>>
[2020-02-14 18:58:48,586] DEBUG SteamClient: Emit event: <EMsg.Multi: 1>
[2020-02-14 18:58:48,586] DEBUG SteamClient: Multi: Unpacking
[2020-02-14 18:58:48,586] DEBUG SteamClient: Incoming: <MsgProto <EMsg.ClientFromGC: 5453>>
[2020-02-14 18:58:48,586] DEBUG SteamClient: Emit event: <EMsg.ClientFromGC: 5453>
[2020-02-14 18:58:48,587] DEBUG Dota2Client: Incoming: <EDOTAGCMsg.EMsgGCToClientPartyBeaconUpdate: 7667>
[2020-02-14 18:58:48,587] DEBUG Dota2Client: Emit event: <EDOTAGCMsg.EMsgGCToClientPartyBeaconUpdate: 7667>
[2020-02-14 18:58:51,065] DEBUG SteamClient: Outgoing: <MsgProto <EMsg.ClientHeartBeat: 703>>
[2020-02-14 18:59:00,072] DEBUG SteamClient: Outgoing: <MsgProto <EMsg.ClientHeartBeat: 703>>

I have also tried replacing "dota.wait_event(jobid, timeout=10)" with "dota.wait_msg(jobid, timeout=10) and "dota.send_job_and_wait(jobid, timeout=10)"

rossengeorgiev commented 3 years ago
[2020-02-14 18:58:21,739] DEBUG Dota2Client.socache: Emit event: ('new', <ESOType.CSODOTAParty: 2003>)
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Emit event: 'new_party'
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Incoming: <EGCBaseMsg.EMsgGCInvitationCreated: 4502>
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Emit event: <EGCBaseMsg.EMsgGCInvitationCreated: 4502>
[2020-02-14 18:58:21,739] DEBUG Dota2Client: Emit event: 'invitation_created'

Looking at the debug log it appears to have worked. Maybe something in dota has changed, I don't have to test. Double check that you have the correct steamid

Philaeux commented 3 years ago

You can't send Party Invites if you are a free account (never added money/game to account). You can't also talk to lobby etc... You can still invite people to lobby tho.

rossengeorgiev commented 3 years ago

Closing this due to inactivity