File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments