Skip to content

Conversation

@Soheab
Copy link
Contributor

@Soheab Soheab commented Oct 30, 2025

Summary

Convenient method to get all possible arguments without having to use subclass view and use the decorator.

WIP. Needs testing.

Information

  • 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, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@pycord-app
Copy link

pycord-app bot commented Oct 30, 2025

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/2985/head:pr-2985
git checkout pr-2985

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/2985/head

@Soheab Soheab added priority: low Low Priority hold: documentation This pull request is missing documentation hold: changelog This pull request is missing a changelog entry hold: testing This pull request requires further testing optional labels Oct 31, 2025
@Soheab Soheab added the on hold label Nov 7, 2025
@Soheab
Copy link
Contributor Author

Soheab commented Nov 7, 2025

@Lulalaby Lulalaby added this to the v2.8 milestone Dec 24, 2025
@Lulalaby Lulalaby removed the on hold label Dec 24, 2025
elif self.parameters_amount == 2:
return self.func(interaction, self.item) # type: ignore # type checker doesn't like optional params
elif self.parameters_amount == 3:
return self.func(interaction, self.item, self.item.view) # type: ignore # type checker doesn't like optional params
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't view be first ? It is most likely representing "self" in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, more people want access to the button/item rather than the view, so they can do (interaction, button) instead of having to do (interaction, view, button).

Copy link
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

Do we want this, or do we want a callback __init__ param instead ? I feel like set_callback isn't that different from just doing .callback = but maybe I'm missing something. Also if we go this route, we could maybe use functools.partial instead of this proxy class. Idk just some thoughts

@Soheab
Copy link
Contributor Author

Soheab commented Dec 26, 2025

Do we want this, or do we want a callback __init__ param instead ? I feel like set_callback isn't that different from just doing .callback = but maybe I'm missing something. Also if we go this route, we could maybe use functools.partial instead of this proxy class. Idk just some thoughts

The main point is that the user can access the view and button, instead of only the interaction without subclassing or using the decorator in the view/row.

Supporting partial and non async callbacks could be nice too ig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold: changelog This pull request is missing a changelog entry hold: documentation This pull request is missing documentation hold: testing This pull request requires further testing optional priority: low Low Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants