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: Polls limiting duration at 7 days #9871

Merged
merged 1 commit into from
Jul 21, 2024
Merged

Conversation

DA-344
Copy link
Contributor

@DA-344 DA-344 commented Jun 27, 2024

Summary

So Discord recently allowed polls to be 32 days long so the check in Poll._from_data that "fixes" the poll duration at 7 days should be removed.

This also makes sure that if Discord changes the maximum duration for polls again there won't be any problems.

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

Comment on lines -391 to -393
if (duration.total_seconds() / 3600) > 168: # As the duration may exceed little milliseconds then we fix it
duration = datetime.timedelta(days=7)

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we removing this clamp instead of altering it to meet the new criteria?

Copy link

Choose a reason for hiding this comment

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

I think its better to remove check, since unexpiring polls might come out later

Copy link
Contributor

Choose a reason for hiding this comment

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

...and upon such time we would remove said clamp, we shouldn't be doing it for features we hope discord may release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The check is removed so polls aren't capped at 7 days when obtained via API or gateway, in my opinion updating this every time Discord updates the polls maximum duration would not be right.

Copy link
Contributor

Choose a reason for hiding this comment

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

If that is the argument now then I wonder why it was implemented and accepted in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's unlikely discord ever adds an uncapped poll. The feature doesn't make sense. The point of a poll is getting an answer from a group of people, if it never ends, there's no answer ever.

Copy link
Owner

Choose a reason for hiding this comment

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

It's fine to remove the check and let the server handle it, that's what the library usually does anyway except within discord.ui

Copy link

Choose a reason for hiding this comment

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

It's unlikely discord ever adds an uncapped poll. The feature doesn't make sense. The point of a poll is getting an answer from a group of people, if it never ends, there's no answer ever.

Discord still might add this per discord/discord-api-docs#6746 (comment)

@DA-344 DA-344 closed this Jul 18, 2024
@DA-344 DA-344 deleted the patch-8 branch July 18, 2024 15:28
@DA-344 DA-344 restored the patch-8 branch July 18, 2024 15:30
@DA-344
Copy link
Contributor Author

DA-344 commented Jul 18, 2024

Damn this thing closed lol, sorry about that gonna reopen it

@DA-344 DA-344 reopened this Jul 18, 2024
@Rapptz Rapptz merged commit ff638d3 into Rapptz:master Jul 21, 2024
16 checks passed
@DA-344 DA-344 deleted the patch-8 branch July 22, 2024 21:26
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

5 participants