ValvePython / csgo

🔫 Python package for interacting with CS:GO Game Coordinator
http://csgo.readthedocs.io
124 stars 17 forks source link

Getting EMsg.ClientRichPresenceInfo in an event #3

Closed schoerg closed 7 years ago

schoerg commented 7 years ago

Hi, I am trying to get the EMsg.ClientRichPresenceInfo. However I think this info is sent out without sending something else prior.

A function with

@cs.on('EMsg.ClientRichPresenceInfo')
def test(p)
    print(p)

does not seem to work. Can someone point me in the right direction?

rossengeorgiev commented 7 years ago

You are using quotes. What you should be doing is:

from steam.enums.emsg import EMsg

@cs.on(EMsg.ClientRichPresenceInfo)
def test(p):
    print(p)

Then when the Rich Presence for someone on your friend list changes, you will get an event

schoerg commented 7 years ago

Thank you. I tried adding it:

@cs.on(EMsg.ClientRichPresenceInfo)
def test(p):
    print(p)

@cs.on('ready')
def gc_ready():
    print("gc_ready")

client.cli_login("user", "passwd")
client.run_forever()

However I don't get the output of ClientRichPresenceInfo as of now.

These are my imports:

from steam import SteamClient
from steam import steamid
from steam.enums.emsg import EMsg
from csgo import CSGOClient
from csgo.enums import ECsgoGCMsg
from csgo import features

Some debug output:

[2017-02-05 15:32:43,341] DEBUG SteamClient: Multi: Unpacking
[2017-02-05 15:32:43,342] DEBUG SteamClient: Multi: Decompressing payload (230 -> 419)
[2017-02-05 15:32:43,343] DEBUG SteamClient: Incoming: <MsgProto <EMsg.ClientRichPresenceInfo: 7503>>
[2017-02-05 15:32:43,343] DEBUG SteamClient: Emit event: <EMsg.ClientRichPresenceInfo: 7503>
[2017-02-05 15:32:43,344] DEBUG SteamClient: Incoming: <MsgProto <EMsg.ClientRichPresenceInfo: 7503>>
rossengeorgiev commented 7 years ago

Oh right. If look at the log you will notice that the event happens on the SteamClient instance, so client in your case, not CSGOClient.

schoerg commented 7 years ago

Thanks, that was the right hint.