Browse Source

Properly guard for DMs in interaction creation

Fix #6794
pull/6961/head
Rapptz 4 years ago
parent
commit
cc800796a2
  1. 11
      discord/interactions.py

11
discord/interactions.py

@ -117,11 +117,12 @@ class Interaction:
self.user = None
# TODO: there's a potential data loss here
guild = self.guild or Object(id=self.guild_id)
try:
self.user = Member(state=self._state, guild=guild, data=data['member'])
except KeyError:
pass
if self.guild_id:
guild = self.guild or Object(id=self.guild_id)
try:
self.user = Member(state=self._state, guild=guild, data=data['member'])
except KeyError:
pass
@property
def guild(self) -> Optional[Guild]:

Loading…
Cancel
Save