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

Raise TypeError if component custom_id type is not str #1017

Merged
merged 12 commits into from
Feb 20, 2022
Merged

Raise TypeError if component custom_id type is not str #1017

merged 12 commits into from
Feb 20, 2022

Conversation

krittick
Copy link
Contributor

Summary

This change raises a TypeError if a user provides a custom_id for a component (Button, Select, InputText, or Modal) that is not str.

While custom_id is already type hinted to str, this change enforces it as a requirement instead of the current behavior where the interaction silently fails.

Closes #1010

Checklist

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

@krittick krittick added priority: low Low Priority status: awaiting review Awaiting review from a maintainer Merge with squash labels Feb 15, 2022
@krittick krittick self-assigned this Feb 15, 2022
@krittick krittick enabled auto-merge (squash) February 15, 2022 00:50
@Dorukyum
Copy link
Member

isinstance(x, SomeGenericType[y, z]) is not backwards compatible with python 3.8.

discord/ui/button.py Outdated Show resolved Hide resolved
discord/ui/input_text.py Outdated Show resolved Hide resolved
discord/ui/modal.py Outdated Show resolved Hide resolved
discord/ui/select.py Outdated Show resolved Hide resolved
krittick and others added 4 commits February 15, 2022 07:53
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
discord/ui/input_text.py Outdated Show resolved Hide resolved
discord/ui/modal.py Outdated Show resolved Hide resolved
krittick and others added 2 commits February 15, 2022 10:58
Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
discord/ui/input_text.py Outdated Show resolved Hide resolved
discord/ui/modal.py Outdated Show resolved Hide resolved
discord/ui/select.py Outdated Show resolved Hide resolved
@krittick krittick dismissed stale reviews from BobDotCom and Dorukyum February 15, 2022 23:03

stale

Copy link
Member

@Middledot Middledot left a comment

Choose a reason for hiding this comment

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

extra whitespaces

discord/ui/input_text.py Outdated Show resolved Hide resolved
discord/ui/modal.py Outdated Show resolved Hide resolved
Co-authored-by: Middledot <78228142+Middledot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low Low Priority status: awaiting review Awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Providing a custom id that isn't a string silently errors
5 participants