File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -340,13 +340,17 @@ def __init__(self, raw):
340340 self .flags = None
341341 self .extra = None
342342 self .extra_values = None
343+ self .type_id = None
343344
344345 try :
345346 self .type = VkEventType (self .raw [0 ])
346347 self ._list_to_attr (self .raw [1 :], EVENT_ATTRS_MAPPING [self .type ])
347348 except ValueError :
348349 pass
349350
351+ if self .extra_values :
352+ self ._dict_to_attr (self .extra_values )
353+
350354 if self .type in PARSE_PEER_ID_EVENTS :
351355 self ._parse_peer_id ()
352356
@@ -380,9 +384,6 @@ def __init__(self, raw):
380384 if self .timestamp :
381385 self .datetime = datetime .utcfromtimestamp (self .timestamp )
382386
383- if self .extra_values :
384- self ._dict_to_attr (self .extra_values )
385-
386387 def _list_to_attr (self , raw , attrs ):
387388 for i in range (min (len (raw ), len (attrs ))):
388389 self .__setattr__ (attrs [i ], raw [i ])
@@ -400,8 +401,8 @@ def _parse_peer_id(self):
400401 self .from_chat = True
401402 self .chat_id = self .peer_id - CHAT_START_ID
402403
403- if 'from' in self .attachments :
404- self .user_id = int (self .attachments ['from' ])
404+ if self . extra_values and 'from' in self .extra_values :
405+ self .user_id = int (self .extra_values ['from' ])
405406
406407 else : # Сообщение от/для пользователя
407408 self .from_user = True
You can’t perform that action at this time.
0 commit comments