From a726103d55af41eb8959f056baa6acd58c76757f Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 12:15:16 +0300 Subject: [PATCH 01/17] fix: allow Checkbox, CheckboxGroup, FileUpload, RadioGroup default/required to accept None --- discord/ui/checkbox.py | 6 +++--- discord/ui/checkbox_group.py | 6 +++--- discord/ui/file_upload.py | 6 +++--- discord/ui/radio_group.py | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/discord/ui/checkbox.py b/discord/ui/checkbox.py index 5915f9938d..49a4a19bdf 100644 --- a/discord/ui/checkbox.py +++ b/discord/ui/checkbox.py @@ -63,7 +63,7 @@ def __init__( self, *, custom_id: str | None = None, - default: bool = False, + default: bool | None = None, id: int | None = None, ): super().__init__() @@ -71,8 +71,8 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - if not isinstance(default, bool): - raise TypeError(f"default must be bool, not {default.__class__.__name__}") + + default = False if default is None else default custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._value: bool | None = None diff --git a/discord/ui/checkbox_group.py b/discord/ui/checkbox_group.py index ed155898ab..c8703959ef 100644 --- a/discord/ui/checkbox_group.py +++ b/discord/ui/checkbox_group.py @@ -83,7 +83,7 @@ def __init__( options: list[CheckboxGroupOption] | None = None, min_values: int | None = None, max_values: int | None = None, - required: bool = True, + required: bool | None = None, id: int | None = None, ): super().__init__() @@ -95,8 +95,8 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - if not isinstance(required, bool): - raise TypeError(f"required must be bool not {required.__class__.__name__}") + + required = True if required is None else required custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_values: list[str] | None = None diff --git a/discord/ui/file_upload.py b/discord/ui/file_upload.py index 784b8f6733..83800b39c8 100644 --- a/discord/ui/file_upload.py +++ b/discord/ui/file_upload.py @@ -74,7 +74,7 @@ def __init__( custom_id: str | None = None, min_values: int | None = None, max_values: int | None = None, - required: bool = True, + required: bool | None = None, id: int | None = None, ): super().__init__() @@ -86,8 +86,8 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - if not isinstance(required, bool): - raise TypeError(f"required must be bool not {required.__class__.__name__}") # type: ignore + + required = True if required is None else required custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._attachments: list[Attachment] | None = None diff --git a/discord/ui/radio_group.py b/discord/ui/radio_group.py index 7a01501776..b609549688 100644 --- a/discord/ui/radio_group.py +++ b/discord/ui/radio_group.py @@ -71,7 +71,7 @@ def __init__( *, custom_id: str | None = None, options: list[RadioGroupOption] | None = None, - required: bool = True, + required: bool | None = True, id: int | None = None, ): super().__init__() @@ -79,8 +79,8 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - if not isinstance(required, bool): - raise TypeError(f"required must be bool not {required.__class__.__name__}") + + required = True if required is None else required custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_value: str | None = None From b70436913ca71f343727b1f0d00764c4e7d8f4d3 Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 12:16:35 +0300 Subject: [PATCH 02/17] fix: correct set_select overload return types and option kwarg --- discord/ui/label.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/discord/ui/label.py b/discord/ui/label.py index 720b02b226..bb1ca5f571 100644 --- a/discord/ui/label.py +++ b/discord/ui/label.py @@ -264,7 +264,7 @@ def set_select( options: list[SelectOption] | None = ..., required: bool = ..., id: int | None = ..., - ) -> None: ... + ) -> Self: ... @overload def set_select( @@ -279,7 +279,7 @@ def set_select( required: bool = ..., id: int | None = ..., default_values: Sequence[SelectDefaultValue] | None = ..., - ) -> None: ... + ) -> Self: ... @overload def set_select( @@ -297,7 +297,7 @@ def set_select( required: bool = ..., id: int | None = ..., default_values: Sequence[SelectDefaultValue] | None = ..., - ) -> None: ... + ) -> Self: ... def set_select( self, @@ -432,7 +432,7 @@ def set_radio_group( radio = RadioGroup( custom_id=custom_id, - option=options, + options=options, required=required, id=id, ) @@ -474,7 +474,7 @@ def set_checkbox_group( checkboxes = CheckboxGroup( custom_id=custom_id, - option=options, + options=options, min_values=min_values, max_values=max_values, required=required, From 8386af25afdd1e02b723b8e3b18e11b07f255bb7 Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 12:16:52 +0300 Subject: [PATCH 03/17] fix(select): add init overload for non-literal ComponentType --- discord/ui/select.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/discord/ui/select.py b/discord/ui/select.py index df18c9385c..cd7e17dc7e 100644 --- a/discord/ui/select.py +++ b/discord/ui/select.py @@ -236,6 +236,24 @@ def __init__( default_values: Sequence[SelectDefaultValue | ST] | None = ..., ) -> None: ... + @overload + def __init__( + self, + select_type: ComponentType = ..., + *, + custom_id: str | None = ..., + placeholder: str | None = ..., + min_values: int = ..., + max_values: int = ..., + options: list[SelectOption] | None = ..., + channel_types: list[ChannelType] | None = ..., + disabled: bool = ..., + row: int | None = ..., + id: int | None = ..., + required: bool | None = ..., + default_values: Sequence[SelectDefaultValue | ST] | None = ..., + ) -> None: ... + def __init__( self, select_type: ComponentType = ComponentType.string_select, From 8b355aea14dcf413010d1cde4e190ceca4fd99f7 Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 12:21:05 +0300 Subject: [PATCH 04/17] chore: update changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a096b12cc..2fce4a978e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,17 @@ These changes are available on the `master` branch, but have not yet been releas - Fix `TypeError` when accessing `ApplicationCommand.guild_only` or `SlashCommandGroup.guild_only` when `contexts` is `None`. ([#3320](https://github.com/Pycord-Development/pycord/pull/3320)) +- Fix `Select.__init__` type overloads so that a non-literal + `ComponentType` is accepted. + ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) +- Fix `RadioGroup`, `CheckboxGroup`, and `FileUpload` not accepting `None` + for the `required` parameter. + ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) +- Fix `Checkbox` not accepting `None` for the `default` parameter. + ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) +- Fix the `option` keyword argument name to `options` in + `Label.set_radio_group` and `Label.set_checkbox_group`. + ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) ### Deprecated From f8c3be05ffa02289694726488b24e2a88c6c5d3e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 09:26:02 +0000 Subject: [PATCH 05/17] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 13 ++++++------- discord/ui/checkbox.py | 2 +- discord/ui/checkbox_group.py | 2 +- discord/ui/file_upload.py | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fce4a978e..885830b3f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,16 +22,15 @@ These changes are available on the `master` branch, but have not yet been releas - Fix `TypeError` when accessing `ApplicationCommand.guild_only` or `SlashCommandGroup.guild_only` when `contexts` is `None`. ([#3320](https://github.com/Pycord-Development/pycord/pull/3320)) -- Fix `Select.__init__` type overloads so that a non-literal - `ComponentType` is accepted. - ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) -- Fix `RadioGroup`, `CheckboxGroup`, and `FileUpload` not accepting `None` - for the `required` parameter. +- Fix `Select.__init__` type overloads so that a non-literal `ComponentType` is + accepted. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) +- Fix `RadioGroup`, `CheckboxGroup`, and `FileUpload` not accepting `None` for the + `required` parameter. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) - Fix `Checkbox` not accepting `None` for the `default` parameter. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) -- Fix the `option` keyword argument name to `options` in - `Label.set_radio_group` and `Label.set_checkbox_group`. +- Fix the `option` keyword argument name to `options` in `Label.set_radio_group` and + `Label.set_checkbox_group`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) ### Deprecated diff --git a/discord/ui/checkbox.py b/discord/ui/checkbox.py index 49a4a19bdf..1e8f181e5c 100644 --- a/discord/ui/checkbox.py +++ b/discord/ui/checkbox.py @@ -71,7 +71,7 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - + default = False if default is None else default custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._value: bool | None = None diff --git a/discord/ui/checkbox_group.py b/discord/ui/checkbox_group.py index c8703959ef..307f9de3f1 100644 --- a/discord/ui/checkbox_group.py +++ b/discord/ui/checkbox_group.py @@ -95,7 +95,7 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - + required = True if required is None else required custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_values: list[str] | None = None diff --git a/discord/ui/file_upload.py b/discord/ui/file_upload.py index 83800b39c8..cdb0ea2066 100644 --- a/discord/ui/file_upload.py +++ b/discord/ui/file_upload.py @@ -86,7 +86,7 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - + required = True if required is None else required custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._attachments: list[Attachment] | None = None From 7187afa6056734074f94d30c03f21e7cce32307c Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 12:39:10 +0300 Subject: [PATCH 06/17] revert: type checks --- discord/ui/checkbox.py | 3 +++ discord/ui/checkbox_group.py | 3 +++ discord/ui/file_upload.py | 3 +++ discord/ui/radio_group.py | 3 +++ 4 files changed, 12 insertions(+) diff --git a/discord/ui/checkbox.py b/discord/ui/checkbox.py index 49a4a19bdf..eba289664f 100644 --- a/discord/ui/checkbox.py +++ b/discord/ui/checkbox.py @@ -73,6 +73,9 @@ def __init__( ) default = False if default is None else default + if not isinstance(default, bool): + raise TypeError(f"default must be bool, not {default.__class__.__name__}") + custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._value: bool | None = None diff --git a/discord/ui/checkbox_group.py b/discord/ui/checkbox_group.py index c8703959ef..e6264aa27b 100644 --- a/discord/ui/checkbox_group.py +++ b/discord/ui/checkbox_group.py @@ -97,6 +97,9 @@ def __init__( ) required = True if required is None else required + if not isinstance(required, bool): + raise TypeError(f"required must be bool not {required.__class__.__name__}") + custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_values: list[str] | None = None diff --git a/discord/ui/file_upload.py b/discord/ui/file_upload.py index 83800b39c8..59c1cd497b 100644 --- a/discord/ui/file_upload.py +++ b/discord/ui/file_upload.py @@ -88,6 +88,9 @@ def __init__( ) required = True if required is None else required + if not isinstance(required, bool): + raise TypeError(f"required must be bool not {required.__class__.__name__}") + custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._attachments: list[Attachment] | None = None diff --git a/discord/ui/radio_group.py b/discord/ui/radio_group.py index b609549688..126e1289d8 100644 --- a/discord/ui/radio_group.py +++ b/discord/ui/radio_group.py @@ -81,6 +81,9 @@ def __init__( ) required = True if required is None else required + if not isinstance(required, bool): + raise TypeError(f"required must be bool not {required.__class__.__name__}") + custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_value: str | None = None From 068813c274579fad21f42291cdf2bb70cf2e3b54 Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 12:40:33 +0300 Subject: [PATCH 07/17] chore: update changelog --- CHANGELOG.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fce4a978e..bc13af6760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,16 +22,13 @@ These changes are available on the `master` branch, but have not yet been releas - Fix `TypeError` when accessing `ApplicationCommand.guild_only` or `SlashCommandGroup.guild_only` when `contexts` is `None`. ([#3320](https://github.com/Pycord-Development/pycord/pull/3320)) -- Fix `Select.__init__` type overloads so that a non-literal - `ComponentType` is accepted. +- Fix `required` parameter not accepting `None` in `RadioGroup`, + `CheckboxGroup`, and `FileUpload`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) -- Fix `RadioGroup`, `CheckboxGroup`, and `FileUpload` not accepting `None` - for the `required` parameter. +- Fix `default` parameter not accepting `None` in `Checkbox`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) -- Fix `Checkbox` not accepting `None` for the `default` parameter. - ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) -- Fix the `option` keyword argument name to `options` in - `Label.set_radio_group` and `Label.set_checkbox_group`. +- Fix `option` keyword argument in `Label.set_radio_group` and + `Label.set_checkbox_group`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) ### Deprecated From 2247e3842711e70fa24221ef53783c0e85abba3f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 09:41:33 +0000 Subject: [PATCH 08/17] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 5 ++--- discord/ui/checkbox_group.py | 2 +- discord/ui/file_upload.py | 2 +- discord/ui/radio_group.py | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc13af6760..c2bd414989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,9 +22,8 @@ These changes are available on the `master` branch, but have not yet been releas - Fix `TypeError` when accessing `ApplicationCommand.guild_only` or `SlashCommandGroup.guild_only` when `contexts` is `None`. ([#3320](https://github.com/Pycord-Development/pycord/pull/3320)) -- Fix `required` parameter not accepting `None` in `RadioGroup`, - `CheckboxGroup`, and `FileUpload`. - ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) +- Fix `required` parameter not accepting `None` in `RadioGroup`, `CheckboxGroup`, and + `FileUpload`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) - Fix `default` parameter not accepting `None` in `Checkbox`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) - Fix `option` keyword argument in `Label.set_radio_group` and diff --git a/discord/ui/checkbox_group.py b/discord/ui/checkbox_group.py index 476df3793c..087e1b918c 100644 --- a/discord/ui/checkbox_group.py +++ b/discord/ui/checkbox_group.py @@ -99,7 +99,7 @@ def __init__( required = True if required is None else required if not isinstance(required, bool): raise TypeError(f"required must be bool not {required.__class__.__name__}") - + custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_values: list[str] | None = None diff --git a/discord/ui/file_upload.py b/discord/ui/file_upload.py index 65fc46394d..2ca1e74547 100644 --- a/discord/ui/file_upload.py +++ b/discord/ui/file_upload.py @@ -90,7 +90,7 @@ def __init__( required = True if required is None else required if not isinstance(required, bool): raise TypeError(f"required must be bool not {required.__class__.__name__}") - + custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._attachments: list[Attachment] | None = None diff --git a/discord/ui/radio_group.py b/discord/ui/radio_group.py index 126e1289d8..0b75a76630 100644 --- a/discord/ui/radio_group.py +++ b/discord/ui/radio_group.py @@ -83,7 +83,7 @@ def __init__( required = True if required is None else required if not isinstance(required, bool): raise TypeError(f"required must be bool not {required.__class__.__name__}") - + custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_value: str | None = None From c07860c02e662d71aafd4f384665c1f85a4daaeb Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 15:44:58 +0300 Subject: [PATCH 09/17] fix: make CheckBox, CheckBoxGroup, FileUpload, RadioGroup not nullable --- discord/ui/checkbox.py | 10 ++++------ discord/ui/checkbox_group.py | 8 +++----- discord/ui/file_upload.py | 6 ++---- discord/ui/label.py | 6 +++--- discord/ui/radio_group.py | 4 +--- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/discord/ui/checkbox.py b/discord/ui/checkbox.py index cf3b71221f..dbd9a0e749 100644 --- a/discord/ui/checkbox.py +++ b/discord/ui/checkbox.py @@ -47,8 +47,8 @@ class Checkbox(ModalItem): ---------- custom_id: Optional[:class:`str`] The ID of the checkbox that gets received during an interaction. - default: Optional[:class:`bool`] - Whether this checkbox is selected by default or not. + default: :class:`bool` + Whether this checkbox is selected by default or not. Defaults to ``True``. id: Optional[:class:`int`] The checkbox's ID. """ @@ -63,7 +63,7 @@ def __init__( self, *, custom_id: str | None = None, - default: bool | None = None, + default: bool = True, id: int | None = None, ): super().__init__() @@ -71,11 +71,9 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - - default = False if default is None else default + if not isinstance(default, bool): raise TypeError(f"default must be bool, not {default.__class__.__name__}") - custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._value: bool | None = None diff --git a/discord/ui/checkbox_group.py b/discord/ui/checkbox_group.py index 087e1b918c..613d655766 100644 --- a/discord/ui/checkbox_group.py +++ b/discord/ui/checkbox_group.py @@ -61,7 +61,7 @@ class CheckboxGroup(ModalItem): max_values: Optional[:class:`int`] The maximum number of options that can be selected. Must be between 1 and 10, inclusive. - required: Optional[:class:`bool`] + required: :class:`bool` Whether an option selection is required or not. Defaults to ``True``. id: Optional[:class:`int`] The checkbox group's ID. @@ -83,7 +83,7 @@ def __init__( options: list[CheckboxGroupOption] | None = None, min_values: int | None = None, max_values: int | None = None, - required: bool | None = None, + required: bool = True, id: int | None = None, ): super().__init__() @@ -95,11 +95,9 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - - required = True if required is None else required + if not isinstance(required, bool): raise TypeError(f"required must be bool not {required.__class__.__name__}") - custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_values: list[str] | None = None diff --git a/discord/ui/file_upload.py b/discord/ui/file_upload.py index 2ca1e74547..7ab6182f52 100644 --- a/discord/ui/file_upload.py +++ b/discord/ui/file_upload.py @@ -54,7 +54,7 @@ class FileUpload(ModalItem): max_values: Optional[:class:`int`] The maximum number of files that can be uploaded. Must be between 1 and 10, inclusive. - required: Optional[:class:`bool`] + required: :class:`bool` Whether the file upload field is required or not. Defaults to ``True``. id: Optional[:class:`int`] The file upload field's ID. @@ -74,7 +74,7 @@ def __init__( custom_id: str | None = None, min_values: int | None = None, max_values: int | None = None, - required: bool | None = None, + required: bool = True, id: int | None = None, ): super().__init__() @@ -87,10 +87,8 @@ def __init__( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - required = True if required is None else required if not isinstance(required, bool): raise TypeError(f"required must be bool not {required.__class__.__name__}") - custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._attachments: list[Attachment] | None = None diff --git a/discord/ui/label.py b/discord/ui/label.py index bb1ca5f571..963f9752bc 100644 --- a/discord/ui/label.py +++ b/discord/ui/label.py @@ -371,7 +371,7 @@ def set_file_upload( custom_id: str | None = None, min_values: int | None = None, max_values: int | None = None, - required: bool | None = True, + required: bool = True, id: int | None = None, ) -> Self: """Set this label's item to a file upload. @@ -389,7 +389,7 @@ def set_file_upload( max_values: Optional[:class:`int`] The maximum number of files that can be uploaded. Must be between 1 and 10, inclusive. - required: Optional[:class:`bool`] + required: :class:`bool` Whether the file upload field is required or not. Defaults to ``True``. id: Optional[:class:`int`] The file upload field's ID. @@ -410,7 +410,7 @@ def set_radio_group( *, custom_id: str | None = None, options: list[RadioGroupOption] | None = None, - required: bool | None = True, + required: bool = True, id: int | None = None, ) -> Self: """Set this label's item to a radio group. diff --git a/discord/ui/radio_group.py b/discord/ui/radio_group.py index 0b75a76630..075ce08675 100644 --- a/discord/ui/radio_group.py +++ b/discord/ui/radio_group.py @@ -71,7 +71,7 @@ def __init__( *, custom_id: str | None = None, options: list[RadioGroupOption] | None = None, - required: bool | None = True, + required: bool = True, id: int | None = None, ): super().__init__() @@ -80,10 +80,8 @@ def __init__( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - required = True if required is None else required if not isinstance(required, bool): raise TypeError(f"required must be bool not {required.__class__.__name__}") - custom_id = os.urandom(16).hex() if custom_id is None else custom_id self._selected_value: str | None = None From 3425a5bcd404c2151b282c8c79938b24042cbaa8 Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 15:51:12 +0300 Subject: [PATCH 10/17] chore: update changelog --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2bd414989..00feec6c1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,15 +17,15 @@ These changes are available on the `master` branch, but have not yet been releas ### Changed +- Changed `Label.set_radio_group` and `Label.set_checkbox_group` to no longer + accept a nullable `required` value. + ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) + ### Fixed - Fix `TypeError` when accessing `ApplicationCommand.guild_only` or `SlashCommandGroup.guild_only` when `contexts` is `None`. ([#3320](https://github.com/Pycord-Development/pycord/pull/3320)) -- Fix `required` parameter not accepting `None` in `RadioGroup`, `CheckboxGroup`, and - `FileUpload`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) -- Fix `default` parameter not accepting `None` in `Checkbox`. - ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) - Fix `option` keyword argument in `Label.set_radio_group` and `Label.set_checkbox_group`. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) From 9f88c3b2a1f29036bf2e32e22a5e6873aaf6f2e4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 12:51:47 +0000 Subject: [PATCH 11/17] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 4 ++-- discord/ui/checkbox.py | 2 +- discord/ui/checkbox_group.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00feec6c1e..477f824cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,8 +17,8 @@ These changes are available on the `master` branch, but have not yet been releas ### Changed -- Changed `Label.set_radio_group` and `Label.set_checkbox_group` to no longer - accept a nullable `required` value. +- Changed `Label.set_radio_group` and `Label.set_checkbox_group` to no longer accept a + nullable `required` value. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) ### Fixed diff --git a/discord/ui/checkbox.py b/discord/ui/checkbox.py index dbd9a0e749..740a9b58b2 100644 --- a/discord/ui/checkbox.py +++ b/discord/ui/checkbox.py @@ -71,7 +71,7 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - + if not isinstance(default, bool): raise TypeError(f"default must be bool, not {default.__class__.__name__}") custom_id = os.urandom(16).hex() if custom_id is None else custom_id diff --git a/discord/ui/checkbox_group.py b/discord/ui/checkbox_group.py index 613d655766..abeb75466e 100644 --- a/discord/ui/checkbox_group.py +++ b/discord/ui/checkbox_group.py @@ -95,7 +95,7 @@ def __init__( raise TypeError( f"expected custom_id to be str, not {custom_id.__class__.__name__}" ) - + if not isinstance(required, bool): raise TypeError(f"required must be bool not {required.__class__.__name__}") custom_id = os.urandom(16).hex() if custom_id is None else custom_id From 7d4235e6c072002af16f6cdcc3a04d1d3317221d Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 16:06:41 +0300 Subject: [PATCH 12/17] fix(checkbox): default to False --- discord/ui/checkbox.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/ui/checkbox.py b/discord/ui/checkbox.py index 740a9b58b2..30784b2e06 100644 --- a/discord/ui/checkbox.py +++ b/discord/ui/checkbox.py @@ -48,7 +48,7 @@ class Checkbox(ModalItem): custom_id: Optional[:class:`str`] The ID of the checkbox that gets received during an interaction. default: :class:`bool` - Whether this checkbox is selected by default or not. Defaults to ``True``. + Whether this checkbox is selected by default or not. Defaults to ``False``. id: Optional[:class:`int`] The checkbox's ID. """ @@ -63,7 +63,7 @@ def __init__( self, *, custom_id: str | None = None, - default: bool = True, + default: bool = False, id: int | None = None, ): super().__init__() From 8be51309f4b86a1d3a7a14dae8516d9a59c0742e Mon Sep 17 00:00:00 2001 From: vmphase Date: Fri, 7 Aug 2026 18:59:00 +0300 Subject: [PATCH 13/17] refactor(ui/label): remove unused imports --- discord/ui/label.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/discord/ui/label.py b/discord/ui/label.py index 963f9752bc..d83754b0aa 100644 --- a/discord/ui/label.py +++ b/discord/ui/label.py @@ -29,22 +29,17 @@ from ..components import ( CheckboxGroupOption, -) -from ..components import Label as LabelComponent -from ..components import ( RadioGroupOption, SelectDefaultValue, SelectOption, - _component_factory, ) -from ..enums import ButtonStyle, ChannelType, ComponentType, InputTextStyle -from ..utils import find, get -from .button import Button +from ..components import Label as LabelComponent +from ..enums import ChannelType, ComponentType, InputTextStyle from .checkbox import Checkbox from .checkbox_group import CheckboxGroup from .file_upload import FileUpload from .input_text import InputText -from .item import ItemCallbackType, ModalItem +from .item import ModalItem from .radio_group import RadioGroup from .select import Select @@ -53,9 +48,7 @@ if TYPE_CHECKING: from typing_extensions import Self - from ..emoji import AppEmoji, GuildEmoji from ..interactions import Interaction - from ..partial_emoji import PartialEmoji, _EmojiTag from ..types.components import LabelComponent as LabelComponentPayload from .modal import DesignerModal From f25f935709b8ba13fd6a6dc0e4210841f94cb0f2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 15:59:36 +0000 Subject: [PATCH 14/17] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/ui/label.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/discord/ui/label.py b/discord/ui/label.py index d83754b0aa..cbec8ff1bb 100644 --- a/discord/ui/label.py +++ b/discord/ui/label.py @@ -29,11 +29,9 @@ from ..components import ( CheckboxGroupOption, - RadioGroupOption, - SelectDefaultValue, - SelectOption, ) from ..components import Label as LabelComponent +from ..components import RadioGroupOption, SelectDefaultValue, SelectOption from ..enums import ChannelType, ComponentType, InputTextStyle from .checkbox import Checkbox from .checkbox_group import CheckboxGroup From 67482eee645026bc0dc8e9861fdc043aaf910821 Mon Sep 17 00:00:00 2001 From: vmphase Date: Mon, 10 Aug 2026 18:47:28 +0300 Subject: [PATCH 15/17] chore: fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b29e6002b3..1049f46bf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ These changes are available on the `master` branch, but have not yet been releas ### Changed -- Changed `Label.set_radio_group` and `Label.set_checkbox_group` to no longer accept a +- Changed `Label.set_radio_group` and `Label.set_file_upload` to no longer accept a nullable `required` value. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) From 86bcdcb6243905ce8964b7d44d261fc59154f240 Mon Sep 17 00:00:00 2001 From: vmphase Date: Mon, 10 Aug 2026 18:55:04 +0300 Subject: [PATCH 16/17] chore: apply readme suggestion Co-authored-by: Paillat --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1049f46bf5..32a3fb5652 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ These changes are available on the `master` branch, but have not yet been releas `SlashCommandGroup.guild_only` when `contexts` is `None`. ([#3320](https://github.com/Pycord-Development/pycord/pull/3320)) - Fix `option` keyword argument in `Label.set_radio_group` and - `Label.set_checkbox_group`. + `Label.set_checkbox_group` that caused `TypeError` when used. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) - Fix `SyntaxWarning` about `return` in a `finally` block raised on Python 3.14+ ([#3332](https://github.com/Pycord-Development/pycord/pull/3334)) From ec35627ef2f3a9a9dd5693b12deed63f7c4195d5 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 11 Aug 2026 09:28:04 +0300 Subject: [PATCH 17/17] chore: apply suggestions from code review Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: Michael --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32a3fb5652..7e5a597043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ These changes are available on the `master` branch, but have not yet been releas ### Changed -- Changed `Label.set_radio_group` and `Label.set_file_upload` to no longer accept a +- Changed `Label.set_radio_group()` and `Label.set_file_upload()` to no longer accept a nullable `required` value. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) @@ -26,8 +26,8 @@ These changes are available on the `master` branch, but have not yet been releas - Fix `TypeError` when accessing `ApplicationCommand.guild_only` or `SlashCommandGroup.guild_only` when `contexts` is `None`. ([#3320](https://github.com/Pycord-Development/pycord/pull/3320)) -- Fix `option` keyword argument in `Label.set_radio_group` and - `Label.set_checkbox_group` that caused `TypeError` when used. +- Fix `option` keyword argument in `Label.set_radio_group()` and + `Label.set_checkbox_group()` that caused `TypeError` when used. ([#3337](https://github.com/Pycord-Development/pycord/pull/3337)) - Fix `SyntaxWarning` about `return` in a `finally` block raised on Python 3.14+ ([#3332](https://github.com/Pycord-Development/pycord/pull/3334))