Skip to content

Commit addc91a

Browse files
Марат Недогимовpython273
authored andcommitted
Update VkBotEvent for v5.103 (#310)
1 parent af51659 commit addc91a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

vk_api/bot_longpoll.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class VkBotEvent(object):
109109
'raw',
110110
't', 'type',
111111
'obj', 'object',
112+
'client_info', 'message',
112113
'group_id'
113114
)
114115

@@ -123,7 +124,15 @@ def __init__(self, raw):
123124
self.t = self.type # shortcut
124125

125126
self.object = DotDict(raw['object'])
127+
try:
128+
self.message = DotDict(raw['object']['message'])
129+
except KeyError:
130+
self.message = None
126131
self.obj = self.object
132+
try:
133+
self.client_info = DotDict(raw['object']['client_info'])
134+
except KeyError:
135+
self.client_info = None
127136

128137
self.group_id = raw['group_id']
129138

@@ -157,7 +166,7 @@ def __init__(self, raw):
157166
self.from_group = False
158167
self.chat_id = None
159168

160-
peer_id = self.obj.peer_id or self.obj.message['peer_id']
169+
peer_id = self.obj.peer_id or self.message.peer_id
161170

162171
if peer_id < 0:
163172
self.from_group = True

0 commit comments

Comments
 (0)