diff --git a/steam/client/builtins/user.py b/steam/client/builtins/user.py index c1b7f2a..d6b84c0 100644 --- a/steam/client/builtins/user.py +++ b/steam/client/builtins/user.py @@ -1,6 +1,6 @@ from weakref import WeakValueDictionary from steam.client.user import SteamUser -from steam.enums import EPersonaState +from steam.enums import EPersonaState, EChatEntryType from steam.enums.emsg import EMsg from steam.core.msg import MsgProto from steam.util import proto_fill_from_dict @@ -29,7 +29,7 @@ class User(object): self.on(EMsg.ClientFriendMsgIncoming, self.__handle_message_incoming) def __handle_message_incoming(self, msg): - if msg.body.chat_entry_type == 1: + if msg.body.chat_entry_type == EChatEntryType.ChatMsg: user = self.get_user(msg.body.steamid_from) self.emit("chat_message", user, msg.body.message) diff --git a/steam/client/user.py b/steam/client/user.py index 485543d..4d19fb4 100644 --- a/steam/client/user.py +++ b/steam/client/user.py @@ -2,7 +2,7 @@ from datetime import datetime from binascii import hexlify from gevent.event import Event from steam.steamid import SteamID -from steam.enums import EFriendRelationship, EPersonaState +from steam.enums import EFriendRelationship, EPersonaState, EChatEntryType from steam.enums.emsg import EMsg from steam.core.msg import MsgProto @@ -95,6 +95,6 @@ class SteamUser(object): """ self._steam.send(MsgProto(EMsg.ClientFriendMsg), { 'steamid': self.steam_id, - 'chat_entry_type': 1, + 'chat_entry_type': EChatEntryType.ChatMsg, 'message': message.encode('utf8'), }) diff --git a/steam/enums/common.py b/steam/enums/common.py index 434f059..e4d6223 100644 --- a/steam/enums/common.py +++ b/steam/enums/common.py @@ -374,6 +374,23 @@ class ETwoFactorTokenType(SteamIntEnum): ValveMobileApp = 1 ThirdParty = 2 +class EChatEntryType(SteamIntEnum): + Invalid = 0 + ChatMsg = 1 + Typing = 2 + InviteGame = 3 + Emote = 4 # No longer supported by clients + LobbyGameStart = 5 # Listen for LobbyGameCreated_t callback instead + LeftConversation = 6 + Entered = 7 + WasKicked = 8 + WasBanned = 9 + Disconnected = 10 + HistoricalChat = 11 + Reserved1 = 12 + Reserved2 = 13 + LinkBlocked = 14 + # Do not remove from sys import modules from enum import EnumMeta