Skip to content

Conversation

@Midblyte
Copy link
Contributor

Description

Currently, there's no way to create a poll ("quiz" type) without any explanation using Client.send_poll.
When explanation parameter is not passed (explanation=None), current code stringifies None to "None".
But, when explanation=None, explanation_entities is required to be None too (explanation_entities=None), while current solution forces explanation_entities to always be a list.
This patch ensures that the required cases get handled properly, fixing the current bugs.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

I manually tested various combinations of parameters (explanation and explanation_entities) of Client.send_poll.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@HitaloM HitaloM added the bug Something is wrong label Mar 18, 2024
Copy link
Member

@HitaloM HitaloM left a comment

Choose a reason for hiding this comment

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

I've reviewed the changes and everything looks good to me. Great work on this pull request!

@HitaloM HitaloM merged commit 51bcd62 into hydrogram:dev Mar 23, 2024
tangyoha pushed a commit to tangyoha/hydrogram that referenced this pull request Jul 14, 2024
Co-authored-by: Colin <colin@colinshark.de>
Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
Co-authored-by: Akkia <AkkiaS7@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants