ValvePython / steam

☁️ Python package for interacting with Steam
http://steam.readthedocs.io
MIT License
1.05k stars 127 forks source link

[BUG] Unable to send message which only has payload #412

Closed adminerest closed 1 year ago

adminerest commented 1 year ago

Description https://github.com/ValvePython/steam/blob/eb3bf3188f83252eedf7d31ea283fc94390a1127/steam/core/cm.py#L191-L219 In the send function, for the line 211, the message needs to do serialize() https://github.com/ValvePython/steam/blob/eb3bf3188f83252eedf7d31ea283fc94390a1127/steam/core/msg/__init__.py#L118-L119 For both Msg and MsgProto, they have both only Serialize the body. The problem is, if I pass a msg which can't match any proto (e.g. EMsg.ClientMicroTxnAuthRequest), the body can't be parsed and it will become to '!!! Failed to resolve message !!!'. So when running the send function, the message can't serialize the body which will raise AttributeError: 'str' object has no attribute 'SerializeToString'

Steps to Reproduce the behavior (Include debug logs if possible and relevant)

message = MsgProto(EMsg.ClientMicroTxnAuthorize, parse=False)
                message.payload = payload
                message.parse()
                result = client.send_message_and_wait(message=message,
                                                      response_emsg=EMsg.ClientMicroTxnAuthorizeResponse,
                                                      timeout=10)

Expected behavior A clear and concise description of what you expected to happen. If message.body can't be parsed, the Serialize function should use payload instead

Versions Report Python Version: 3.10.8 Package Version: 1.4.3

adminerest commented 1 year ago

156 My bad that I haven't done a thoroughly search

So current suggestion is could we just simple it by not implementing a new class so we can just use payload?

rossengeorgiev commented 1 year ago

Don't see value in implementing this, except making it easy to send garbage. Any missing messages, should be implemented and mapped.