Skip to content

Commit

Permalink
Merge pull request #107 from Breq16/bug/dm-user-command
Browse files Browse the repository at this point in the history
Handle user commands when user is not a member (left the guild or in DM)
  • Loading branch information
breqdev authored Jul 10, 2022
2 parents 6076d22 + 62ca189 commit 5815714
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flask_discord_interactions/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ def parse_target(self):
message. This method sets the `ctx.target` field.
"""
if self.type == ApplicationCommandType.USER:
self.target = self.members[self.target_id]
if self.target_id in self.members:
self.target = self.members[self.target_id]
else:
self.target = self.users[self.target_id]
elif self.type == ApplicationCommandType.MESSAGE:
self.target = self.messages[self.target_id]
else:
Expand Down

0 comments on commit 5815714

Please sign in to comment.