Skip to content

5.3.0 #1381

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

Merged
merged 17 commits into from
May 6, 2023
Merged

5.3.0 #1381

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add component property to ComponentContext (#1371)
* feat: add component to property of ComponentContext

* format: formatting run through

* Fix Typehints and docs

* fix Grammar Error for docs
  • Loading branch information
GeomKid authored May 2, 2023
commit 7c00cff8c8f43e3988aaca3a7fe757e802c41afe
10 changes: 10 additions & 0 deletions interactions/models/internal/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,16 @@ async def edit_origin(
self.message_id = message.id
return message

@property
def component(self) -> typing.Optional[BaseComponent]:
"""The component that was interacted with."""
if self.message is None or self.message.components is None:
return None
for action_row in self.message.components:
for component in action_row.components:
if component.custom_id == self.custom_id:
return component


class ModalContext(InteractionContext):
responses: dict[str, str]
Expand Down