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

fix: Return the correct timeout in _expires_at #497

Merged
merged 2 commits into from
Mar 19, 2022

Conversation

Skelmis
Copy link
Collaborator

@Skelmis Skelmis commented Feb 24, 2022

Summary

This pull request fixes the View._expires_at decor so that it returns the correct timeout.

If you wish to check this yourself

        from discord import ui
        import asyncio

        class MF(ui.View):
            @ui.button(label="reset or something")
            async def a(self, _, __):
                self.first = (self._expires_at, self._View__timeout_expiry)
                await asyncio.sleep(2)
                self.second = (self._expires_at, self._View__timeout_expiry)
                print(self.first, self.second, sep="\n")

        await ctx.send("a", view=MF())

They should be the same values both times, however, they are not. This PR resolves that.

Current output:

(34118.328, 34118.328)
(34120.343, 34118.328)

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, ...)

@netlify
Copy link

netlify bot commented Feb 24, 2022

✅ Deploy Preview for nextcord-gh-action ready!

🔨 Explore the source changes: f907da5

🔍 Inspect the deploy log: https://app.netlify.com/sites/nextcord-gh-action/deploys/6235d9933c3c580008a642d8

😎 Browse the preview: https://deploy-preview-497--nextcord-gh-action.netlify.app

Copy link
Contributor

@TAG-Epic TAG-Epic left a comment

Choose a reason for hiding this comment

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

Not tested

Copy link
Member

@ooliver1 ooliver1 left a comment

Choose a reason for hiding this comment

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

just a code review, can't test as I don't have much idea what this change does

nextcord/ui/view.py Outdated Show resolved Hide resolved
@Skelmis Skelmis requested a review from TAG-Epic March 19, 2022 13:31
@ooliver1 ooliver1 merged commit 0b66ccb into nextcord:master Mar 19, 2022
ooliver1 pushed a commit that referenced this pull request Apr 9, 2022
* fix: Return the correct timeout in _expires_at

* Resolve reviews
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.

4 participants