Skip to content

Commit

Permalink
[trade] fix bulk to show final page (#400)
Browse files Browse the repository at this point in the history
* .

* Show last page for bulk
  • Loading branch information
flaree authored Sep 13, 2024
1 parent e08ce2c commit 2f71d9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
15 changes: 1 addition & 14 deletions ballsdex/packages/trade/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,26 +262,13 @@ async def bulk_add(
f"No {settings.plural_collectible_name} found.", ephemeral=True
)
return

# round balls to closest 25 for display purposes
balls = [x for x in balls if x.is_tradeable]
balls = balls[: len(balls) - (len(balls) % 25)]

if len(balls) < 25:
await interaction.followup.send(
f"You have less than 25 {settings.plural_collectible_name}, "
"you can use the add command instead.",
ephemeral=True,
)
return

view = BulkAddView(interaction, balls, self) # type: ignore
await view.start(
content=f"Select the {settings.plural_collectible_name} you want to add "
"to your proposal, note that the display will wipe on pagination however "
f"the selected {settings.plural_collectible_name} will remain.\n"
f"{settings.plural_collectible_name.title()} were rounded down to closest 25 for "
"display purposes, final page may be missing entries."
f"the selected {settings.plural_collectible_name} will remain."
)

@app_commands.command(extras={"trade": TradeCommandType.REMOVE})
Expand Down
1 change: 1 addition & 0 deletions ballsdex/packages/trade/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def set_options(self, balls: List[BallInstance]):
)
)
self.select_ball_menu.options = options
self.select_ball_menu.max_values = len(options)

@discord.ui.select(min_values=1, max_values=25)
async def select_ball_menu(self, interaction: discord.Interaction, item: discord.ui.Select):
Expand Down

0 comments on commit 2f71d9e

Please sign in to comment.