From ee8197db4d9aaa1d0870e0682e1980b867ce728f Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 16 Sep 2024 23:15:58 +0300 Subject: [PATCH 1/4] not allowing locked balls to be added to a trade with bulk add --- ballsdex/packages/trade/menu.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ballsdex/packages/trade/menu.py b/ballsdex/packages/trade/menu.py index 440f3df2..eda19520 100644 --- a/ballsdex/packages/trade/menu.py +++ b/ballsdex/packages/trade/menu.py @@ -379,6 +379,8 @@ def set_options(self, balls: List[BallInstance]): for ball in balls: if ball.is_tradeable is False: continue + if ball.is_locked(): + continue emoji = self.bot.get_emoji(int(ball.countryball.emoji_id)) favorite = "❤️ " if ball.favorite else "" shiny = "✨ " if ball.shiny else "" From 75f2fdaa29896a4096ad16ea99548e38da6657d3 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:39:22 +0300 Subject: [PATCH 2/4] undo change --- ballsdex/packages/trade/menu.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ballsdex/packages/trade/menu.py b/ballsdex/packages/trade/menu.py index eda19520..440f3df2 100644 --- a/ballsdex/packages/trade/menu.py +++ b/ballsdex/packages/trade/menu.py @@ -379,8 +379,6 @@ def set_options(self, balls: List[BallInstance]): for ball in balls: if ball.is_tradeable is False: continue - if ball.is_locked(): - continue emoji = self.bot.get_emoji(int(ball.countryball.emoji_id)) favorite = "❤️ " if ball.favorite else "" shiny = "✨ " if ball.shiny else "" From 31773beaa2116d0677de36e1cb867355c24e604e Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Tue, 24 Sep 2024 23:15:52 +0300 Subject: [PATCH 3/4] re-adding the check + favorited ball check --- ballsdex/packages/trade/menu.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ballsdex/packages/trade/menu.py b/ballsdex/packages/trade/menu.py index 440f3df2..df7cd19d 100644 --- a/ballsdex/packages/trade/menu.py +++ b/ballsdex/packages/trade/menu.py @@ -11,6 +11,7 @@ from ballsdex.core.models import BallInstance, Player, Trade, TradeObject from ballsdex.core.utils import menus +from ballsdex.core.utils.buttons import ConfirmChoiceView from ballsdex.core.utils.paginator import Pages from ballsdex.packages.balls.countryballs_paginator import CountryballsViewer from ballsdex.packages.trade.display import fill_trade_embed_fields @@ -456,6 +457,22 @@ async def confirm_button(self, interaction: discord.Interaction, button: Button) f"{settings.collectible_name.title()} #{ball.pk:0X} is not tradeable.", ephemeral=True, ) + if await ball.is_locked(): + return await interaction.followup.send( + f"{settings.collectible_name.title()} #{ball.pk:0X} is locked for trade.", + ephemeral=True, + ) + view = ConfirmChoiceView(interaction) + if ball.favorite: + await interaction.followup.send( + f"One or more of the {settings.plural_collectible_name} is favorited, " + "are you sure you want to add it to the trade?", + view=view, + ephemeral=True, + ) + view.wait() + if not view.value: + return trader.proposal.append(ball) await ball.lock_for_trade() grammar = ( From ff3f383ae1fd1aa6a7f6346468f3fdb316755eb5 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Wed, 25 Sep 2024 23:11:33 +0300 Subject: [PATCH 4/4] adding the await i forgot to add --- ballsdex/packages/trade/menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballsdex/packages/trade/menu.py b/ballsdex/packages/trade/menu.py index df7cd19d..78b93e61 100644 --- a/ballsdex/packages/trade/menu.py +++ b/ballsdex/packages/trade/menu.py @@ -470,7 +470,7 @@ async def confirm_button(self, interaction: discord.Interaction, button: Button) view=view, ephemeral=True, ) - view.wait() + await view.wait() if not view.value: return trader.proposal.append(ball)