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

feat!: Add view.parent and store view.message on receiving Interaction for a component #2036

Merged
merged 12 commits into from
May 3, 2023

Conversation

OmLanke
Copy link
Contributor

@OmLanke OmLanke commented May 1, 2023

Summary

Added a view.parent attribute to store the original Interaction object the view was sent with.
view.message is now set when an Interaction for any component of the view is received.

This saves the unnecessary call to interaction.original_response(). The default on_timeout method uses the edit methods offered by Message, InteractionMessage or Interaction (as added in #2026)

Breaking change -

  • view.message is not available on timeout if the view was sent using InteractionResponse.send_message. Instead, use the methods offered by view.parent.

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.

@OmLanke OmLanke changed the title feat!: Added view._parent and store view.message on receiving Interaction for a component feat!: Add view._parent and store view.message on receiving Interaction for a component May 1, 2023
@codecov
Copy link

codecov bot commented May 1, 2023

Codecov Report

Merging #2036 (e5256df) into master (71944ef) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2036      +/-   ##
==========================================
- Coverage   33.25%   33.24%   -0.02%     
==========================================
  Files          97       97              
  Lines       19027    19033       +6     
==========================================
  Hits         6328     6328              
- Misses      12699    12705       +6     
Flag Coverage Δ
macos-latest-3.10 33.23% <0.00%> (-0.02%) ⬇️
macos-latest-3.11 33.23% <0.00%> (-0.02%) ⬇️
macos-latest-3.8 33.24% <0.00%> (-0.02%) ⬇️
macos-latest-3.9 33.24% <0.00%> (-0.02%) ⬇️
ubuntu-latest-3.10 33.23% <0.00%> (-0.02%) ⬇️
ubuntu-latest-3.11 33.23% <0.00%> (-0.02%) ⬇️
ubuntu-latest-3.8 33.24% <0.00%> (-0.02%) ⬇️
ubuntu-latest-3.9 33.24% <0.00%> (-0.02%) ⬇️
windows-latest-3.10 33.23% <0.00%> (-0.02%) ⬇️
windows-latest-3.11 33.23% <0.00%> (-0.02%) ⬇️
windows-latest-3.8 33.24% <0.00%> (-0.02%) ⬇️
windows-latest-3.9 33.24% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
discord/interactions.py 19.54% <0.00%> (ø)
discord/ui/view.py 25.60% <0.00%> (-0.55%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71944ef...e5256df. Read the comment docs.

@Lulalaby Lulalaby closed this May 1, 2023
@Lulalaby Lulalaby reopened this May 1, 2023
@JustaSqu1d JustaSqu1d added priority: medium Medium Priority status: in progress Work in Progess feature Implements a feature python labels May 1, 2023
OmLanke and others added 3 commits May 2, 2023 00:29
@OmLanke OmLanke changed the title feat!: Add view._parent and store view.message on receiving Interaction for a component feat!: Add view.parent and store view.message on receiving Interaction for a component May 3, 2023
@OmLanke OmLanke marked this pull request as ready for review May 3, 2023 15:40
@OmLanke OmLanke requested a review from a team as a code owner May 3, 2023 15:40
@Lulalaby Lulalaby removed the request for review from CodeWithSwastik May 3, 2023 16:25
@Lulalaby Lulalaby requested review from plun1331 and BobDotCom and removed request for Middledot May 3, 2023 16:27
CHANGELOG.md Show resolved Hide resolved
@Lulalaby Lulalaby merged commit b4a1bc9 into Pycord-Development:master May 3, 2023
@OmLanke OmLanke deleted the view-message-refactor branch May 11, 2023 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Implements a feature priority: medium Medium Priority status: in progress Work in Progess
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants