Skip to content

Rewrite taxon menu as component-based menu#210

Closed
synrg wants to merge 60 commits into
mainfrom
PR-taxon-menu
Closed

Rewrite taxon menu as component-based menu#210
synrg wants to merge 60 commits into
mainfrom
PR-taxon-menu

Conversation

@synrg
Copy link
Copy Markdown
Collaborator

@synrg synrg commented Feb 9, 2025

This PR modernizes the taxon menu, bringing it up to the same standards and look-and-feel as our model ,life and ,taxon list commands. All menu, source, and formatter concerns are split off and moved down to dronefly-discord and dronefly-core as needed. When complete, it will finally resolve #141 .

The commands affected are ,taxon and all of its subcommands and variants (e.g. ,img is included as a taxon command), as well as ,tab and all of its subcommands, as both sets of commands support social buttons.

Concepts

  • Social buttons are buttons that any registered user can use to update the menu. For example, the 👤 button is a social button to add or remove the user's own stats for the current display.

Tasks

  • Convert reaction menu to component-based menu.
  • Eliminate round-trip to read/write the message each time a user presses a social button.
  • Use taxon count list source to handle user and place stats tables.
  • Use taxon count formatters for user and place entries.
  • Replace predicate-based user and place query with modal dialogs to handle adding arbitrary user or place (i.e. user 👥 and place 🌍 social buttons) privately.
  • Support every kind of Dronefly query count in taxon displays (i.e. from, by, by id, not by)
  • Make menu, formatter, and source classes for use in ,tab command
  • Also support all Dronefly query counts in tab displays (same as taxon but the per count controlled by buttons differs)
  • Make interactions cache persist across cog reloads.
  • Remove buttons and expire associated interaction cache when the menu messages are no longer in the Discord cache (avoids exceeding DIscord's rate limit on editing old uncached messages).

synrg added 26 commits January 27, 2024 07:43
- Dronefly frequently exceeds Discord's rate limit for edits to uncached
  messages due to members reacting to uncached messages.
- As time passes and a conversation moves on, the value of further
  reactions on older messages diminish, as many people are no longer
  paying attention to those messages.
- Therefore, this change disables reactions on uncached messages.
- This will cause an inconvenience when the bot has been newly restarted,
  as any interactions started before the reload will no longer respond to
  reactions after the reload.
- This could be remedied in subsequent commits by saving/reloading any
  unexpired interactions when the cog unloads/loads.
- Taxonomy button can be pressed by known users
- Cancel button can be pressed by owner only
- No place/user support yet
- Until we resolve cog-specific dependencies (lookup recently active users)
  these buttons will need to remain in the cog instead of lower down
  which we'd prefer.
- Only user interaction validation is performed.
- No update is made to the display yet.
synrg added 28 commits October 11, 2025 13:56
- Also clarify in utils where defaults read from config
  (vs. actual config object) are returned.
- Ideally, anything iNatObsQuery does now will
  migrate fully into core. In the interim, we call
  prepare_query here for single and multiple observation queries.
- config.user() is supposed to return user config not iNat user!
- in core, TaxonMenu does not have a red ctx, so we need to pass
  inat_client down as a new parameter when instantiating the menu
- In order to make commands that look up users (e.g. `by username`, etc.)
  work, we need the user_id() method to succeed when looking up their
  discord user. Therefore, anywhere should be True by default, not False.
- Also added `anywhere` as a parameter so the default can be overridden as
  needed.
@synrg
Copy link
Copy Markdown
Collaborator Author

synrg commented Jan 25, 2026

Enough of the work has been merged back into devel branch that this PR can now be closed. Unfinished ideas in the checklist should have their own issues.

@synrg synrg closed this Jan 25, 2026
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.

taxon/tab embeds: support fast & accurate updates

1 participant