Skip to content

Commit

Permalink
checking if the user is in the server before creating the trade
Browse files Browse the repository at this point in the history
  • Loading branch information
imtherealF1 authored Sep 12, 2024
1 parent 081280c commit b7edf85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ballsdex/packages/trade/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async def begin(self, interaction: discord.Interaction["BallsDexBot"], user: dis
user: discord.User
The user you want to trade with
"""
guild = cast(discord.Guild, interaction.guild)
if user.bot:
await interaction.response.send_message("You cannot trade with bots.", ephemeral=True)
return
Expand All @@ -115,6 +116,11 @@ async def begin(self, interaction: discord.Interaction["BallsDexBot"], user: dis
"You cannot trade with yourself.", ephemeral=True
)
return
if guild.get_member(user.id) is None:
await interaction.response.send_message(
"You cannot trade with a user that is not in the server.", ephemeral=True
)
return

trade1, trader1 = self.get_trade(interaction)
trade2, trader2 = self.get_trade(channel=interaction.channel, user=user) # type: ignore
Expand Down

0 comments on commit b7edf85

Please sign in to comment.