Browse Source

Fix crashes when Message.guild is Object

pull/2570/head
Rapptz 5 years ago
parent
commit
af6a5efa53
  1. 4
      discord/message.py

4
discord/message.py

@ -468,7 +468,7 @@ class Message:
self.mentions = r = [] self.mentions = r = []
guild = self.guild guild = self.guild
state = self._state state = self._state
if guild is None: if not isinstance(guild, Guild):
self.mentions = [state.store_user(m) for m in mentions] self.mentions = [state.store_user(m) for m in mentions]
return return
@ -482,7 +482,7 @@ class Message:
def _handle_mention_roles(self, role_mentions): def _handle_mention_roles(self, role_mentions):
self.role_mentions = [] self.role_mentions = []
if self.guild is not None: if isinstance(self.guild, Guild):
for role_id in map(int, role_mentions): for role_id in map(int, role_mentions):
role = self.guild.get_role(role_id) role = self.guild.get_role(role_id)
if role is not None: if role is not None:

Loading…
Cancel
Save