Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: "TypeError: '<' not supported between instances of 'NoneType' an… #517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions vk_api/longpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,20 +400,21 @@ def _dict_to_attr(self, values):
self.__setattr__(k, v)

def _parse_peer_id(self):
if self.peer_id < 0: # Сообщение от/для группы
self.from_group = True
self.group_id = abs(self.peer_id)

elif self.peer_id > CHAT_START_ID: # Сообщение из беседы
self.from_chat = True
self.chat_id = self.peer_id - CHAT_START_ID

if self.extra_values and 'from' in self.extra_values:
self.user_id = int(self.extra_values['from'])

else: # Сообщение от/для пользователя
self.from_user = True
self.user_id = self.peer_id
if self.peer_id:
if self.peer_id < 0: # Сообщение от/для группы
self.from_group = True
self.group_id = abs(self.peer_id)

elif self.peer_id > CHAT_START_ID: # Сообщение из беседы
self.from_chat = True
self.chat_id = self.peer_id - CHAT_START_ID

if self.extra_values and 'from' in self.extra_values:
self.user_id = int(self.extra_values['from'])

else: # Сообщение от/для пользователя
self.from_user = True
self.user_id = self.peer_id

def _parse_message_flags(self):
self.message_flags = {x for x in VkMessageFlag if self.flags & x}
Expand Down