Skip to content

feat: btn selection for all lookups with servsettings toggle#2199

Merged
codybanman merged 1 commit intoavrae:nightlyfrom
7he4lph4:nightly
Nov 3, 2025
Merged

feat: btn selection for all lookups with servsettings toggle#2199
codybanman merged 1 commit intoavrae:nightlyfrom
7he4lph4:nightly

Conversation

@7he4lph4
Copy link
Copy Markdown
Contributor

@7he4lph4 7he4lph4 commented Jul 27, 2025

EDIT: Below summary is outdated, this now covers all lookups with a servsettings toggle, and enhanced UX during !i madd that lets the user click links to change channels instead of manually changing channels via discord's interface.

Currently enabled for monster lookups only, with easy expansion to other entity types based on feedback.

Summary

Adds interactive buttons for madd and monster selection instead of just text input. Users can now click numbered buttons or still type numbers like before. Currently only enabled for monsters to test the waters. New file handles the button logic, minimal changes to existing code.

Changelog Entry

Interactive button selection for all selection menus with servsettings toggle

Checklist

PR Type

  • This PR is a code change that implements a feature request.
  • This PR fixes an issue.
  • This PR adds a new feature that is not an open feature request.
  • This PR is not a code change (e.g. documentation, README, ...)

Other

  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • If code changes were made then they have been tested.
  • I have updated the documentation to reflect the changes.

1drturtle

This comment was marked as outdated.

@7he4lph4
Copy link
Copy Markdown
Contributor Author

@1drturtle Thanks for taking out the time to review the pr, I've pushed another commit that hopefully adresses all the concerns, here's a screenshot of current latest state you'd asked for:
image

@7he4lph4
Copy link
Copy Markdown
Contributor Author

ah thought I linted, one sec will fix these

@7he4lph4
Copy link
Copy Markdown
Contributor Author

@codybanman amended the lint fix, pls try tests again whenever able, thank you!

@7he4lph4
Copy link
Copy Markdown
Contributor Author

that was a sneaky newline in there, fixed now sorry @codybanman

Copy link
Copy Markdown
Contributor

@codybanman codybanman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First off, thanks putting the time and effort into this. It's a cool idea and definitely makes the !i madd experience better.

There are a few issues I’ve noted in the comments. I didn’t have time to go through everything, but this covers a big portion of it. Please take a look and let me know if you have any questions.

Comment on lines +36 to +56
def _create_selection_buttons(
self, start_idx: int, end_idx: int, current_choices: List[Any], current_page: int, prefix: str
) -> None:
"""Create selection buttons for a given range."""
for i in range(start_idx, end_idx):
if i < len(current_choices):
global_index = i + 1 + current_page * 10
button = disnake.ui.Button(
label=str(global_index),
style=disnake.ButtonStyle.secondary,
disabled=self.expired,
custom_id=f"{prefix}select_{global_index}",
)
else:
button = disnake.ui.Button(
label=str(i + 1 + current_page * 10),
style=disnake.ButtonStyle.secondary,
disabled=True,
custom_id=f"{prefix}placeholder_{i}",
)
self.add_item(button)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _create_selection_buttons(
self, start_idx: int, end_idx: int, current_choices: List[Any], current_page: int, prefix: str
) -> None:
"""Create selection buttons for a given range."""
for i in range(start_idx, end_idx):
if i < len(current_choices):
global_index = i + 1 + current_page * 10
button = disnake.ui.Button(
label=str(global_index),
style=disnake.ButtonStyle.secondary,
disabled=self.expired,
custom_id=f"{prefix}select_{global_index}",
)
else:
button = disnake.ui.Button(
label=str(i + 1 + current_page * 10),
style=disnake.ButtonStyle.secondary,
disabled=True,
custom_id=f"{prefix}placeholder_{i}",
)
self.add_item(button)
def _create_selection_buttons(
self, start_idx: int, end_idx: int, current_choices: List[Any], current_page: int, prefix: str, row: int
) -> None:
"""Create selection buttons for a given range."""
for i in range(start_idx, end_idx):
if i < len(current_choices):
global_index = i + 1 + current_page * 10
self.add_item(disnake.ui.Button(
label=str(global_index),
style=disnake.ButtonStyle.secondary,
disabled=self.expired,
custom_id=f"{prefix}select_{global_index}",
row=row,
)

How about using rows to define where the buttons should be rather than dummy buttons and relying on the buttons automatically being put in rows of 5? Set 0-5 as row 0, 5-10 as row 1, and the navigation buttons as row 2.

Image Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About this, the different shapes of btn layouts thrown every time for different selection sizes felt a bit jarring. There was something nice and familiar about always expecting the same layout and shape.

More of a user preference really, maybe this is something that the users can vote on a poll on the discord request discussion channel? Or an announcement poll, even? I don't mind either way, we can just commit this version of hidden btns too

message: Optional[str] = None,
pm: bool = False,
ctx=None,
is_monster: bool = False,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable isn't used in the function

@7he4lph4
Copy link
Copy Markdown
Contributor Author

Thank you for the detailed review @codybanman good catch on the legacy preferences, couldn't test it without beyond data. Will roll out a commit shortly to fix those and the other issues.

About hiding the btns and disabling the boundary nav btns, have a few points to discuss which I will note above

@7he4lph4
Copy link
Copy Markdown
Contributor Author

7he4lph4 commented Jul 30, 2025

Couldn't test the legacy issue without beyond data, so just added unit tests for the legacy checking, pls do test on beyond data and let me know if any issues.

Otherwise, hopefully everything is ready to go, you can also add in your changes to hide btns (I started a poll on discord) and just roll out to nightly for testing! Looking forward to seeing this on the main bot soon!

@7he4lph4
Copy link
Copy Markdown
Contributor Author

All systems are a GO and ready for launch! Pending tests and review ofc :)

@7he4lph4 7he4lph4 requested a review from codybanman July 31, 2025 09:18
@7he4lph4 7he4lph4 force-pushed the nightly branch 2 times, most recently from 2b57451 to fa8e5f1 Compare August 4, 2025 05:45
@7he4lph4 7he4lph4 force-pushed the nightly branch 3 times, most recently from 799f428 to 0c68413 Compare August 29, 2025 05:33
@7he4lph4 7he4lph4 force-pushed the nightly branch 5 times, most recently from 5283e8a to ed7c0ad Compare October 13, 2025 13:45
@7he4lph4 7he4lph4 changed the title feat: add button-based selection for monster lookups and madd feat: btn selection for all lookups with servsettings toggle Oct 13, 2025
@7he4lph4 7he4lph4 force-pushed the nightly branch 3 times, most recently from d950463 to 8ec69fe Compare October 17, 2025 22:00
@codybanman codybanman merged commit e31cc9e into avrae:nightly Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants