Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store app command ids on CommandTree #9924

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Soheab
Copy link
Contributor

@Soheab Soheab commented Aug 18, 2024

Summary

As it was desired, I have written an implementation that stores app command ids on the CommandTree and keeps them updated via sync, fetch and on callback. Also added two new methods to get the ID and return the mention format.

Currently as a draft because I am not sure if the current impl is the best way to this and would like some feedback on it, ignoring the left over comments/methods but it does work.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Soheab Soheab changed the title Store app commands ids on CommandTree Store app command ids on CommandTree Aug 18, 2024
discord/app_commands/tree.py Outdated Show resolved Hide resolved
discord/app_commands/tree.py Outdated Show resolved Hide resolved
Copy link

@MCausc78 MCausc78 left a comment

Choose a reason for hiding this comment

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

Sorry I forgot few things

discord/app_commands/tree.py Show resolved Hide resolved
discord/app_commands/tree.py Outdated Show resolved Hide resolved
discord/app_commands/tree.py Outdated Show resolved Hide resolved
@mikeshardmind
Copy link
Contributor

I'm not sure I follow the reasoning for this existing since users can specify their own tree class, this is something users could implement without it needing to be extra objects stored for all users of command tree. Or if an implementation which caches this is going to exist in the library, it could be a subclass that's available for users to opt-into.

other more nit-feedback was already mentioned in discord.

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.

None yet

3 participants