From 8a41aa2d9559b0bad3aa32b7df9b3526388852bf Mon Sep 17 00:00:00 2001 From: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> Date: Mon, 20 Nov 2023 00:37:25 -0600 Subject: [PATCH 1/7] Update options.py Signed-off-by: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> --- discord/commands/options.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index 73cda77dc9..5758380cfe 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -141,10 +141,9 @@ class Option: max_length: Optional[:class:`int`] The maximum length of the string that can be entered. Must be between 1 and 6000 (inclusive). Only applies to Options with an :attr:`input_type` of :class:`str`. - autocomplete: Optional[:class:`Any`] - The autocomplete handler for the option. Accepts an iterable of :class:`str` or :class:`OptionChoice`, a callable (sync or async) - that takes a single argument of :class:`AutocompleteContext`, or a coroutine. - Must resolve to an iterable of :class:`str` or :class:`OptionChoice`. + autocomplete: Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]] + The autocomplete handler for the option. Use :func:`discord.utils.basic_autocomplete` to create the callable. + .. note:: From dedc90215dadd726841ae4368a3cd44702237f0a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 06:38:58 +0000 Subject: [PATCH 2/7] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/commands/options.py | 1 - 1 file changed, 1 deletion(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index 5758380cfe..c67bba7375 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -143,7 +143,6 @@ class Option: Only applies to Options with an :attr:`input_type` of :class:`str`. autocomplete: Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]] The autocomplete handler for the option. Use :func:`discord.utils.basic_autocomplete` to create the callable. - .. note:: From 0c2e443d40d64f116dc190f2ca58e763df61569b Mon Sep 17 00:00:00 2001 From: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> Date: Wed, 22 Nov 2023 11:50:36 -0600 Subject: [PATCH 3/7] Update options.py Changed vaugeness Signed-off-by: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> --- discord/commands/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index c67bba7375..664551e7b8 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -142,7 +142,7 @@ class Option: The maximum length of the string that can be entered. Must be between 1 and 6000 (inclusive). Only applies to Options with an :attr:`input_type` of :class:`str`. autocomplete: Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]] - The autocomplete handler for the option. Use :func:`discord.utils.basic_autocomplete` to create the callable. + The autocomplete handler for the option. :func:`discord.utils.basic_autocomplete` may be used to create the callable. .. note:: From 21c43f1082bcb99002fa8df1c74cb732d9adfa95 Mon Sep 17 00:00:00 2001 From: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:52:04 -0600 Subject: [PATCH 4/7] Update discord/commands/options.py Co-authored-by: plun1331 Signed-off-by: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> --- discord/commands/options.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index 664551e7b8..a5f8eb67c7 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -142,7 +142,9 @@ class Option: The maximum length of the string that can be entered. Must be between 1 and 6000 (inclusive). Only applies to Options with an :attr:`input_type` of :class:`str`. autocomplete: Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]] - The autocomplete handler for the option. :func:`discord.utils.basic_autocomplete` may be used to create the callable. + The autocomplete handler for the option. Accepts a a callable (sync or async) + that takes a single argument of :class:`AutocompleteContext` + :func:`discord.utils.basic_autocomplete` may be used to create the callable. .. note:: From 79cf71b6302ac5a2cafca6a560d321808afd7a5d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 2 Dec 2023 23:52:23 +0000 Subject: [PATCH 5/7] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/commands/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index a5f8eb67c7..e3a0dd44c8 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -143,7 +143,7 @@ class Option: Only applies to Options with an :attr:`input_type` of :class:`str`. autocomplete: Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]] The autocomplete handler for the option. Accepts a a callable (sync or async) - that takes a single argument of :class:`AutocompleteContext` + that takes a single argument of :class:`AutocompleteContext` :func:`discord.utils.basic_autocomplete` may be used to create the callable. .. note:: From 1acf35a14022181cdcdce70a8595ee649f08f1f6 Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Fri, 2 Feb 2024 04:51:52 +0100 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: plun1331 Signed-off-by: Lala Sabathil --- discord/commands/options.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index e3a0dd44c8..d1bf0e70bb 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -141,9 +141,9 @@ class Option: max_length: Optional[:class:`int`] The maximum length of the string that can be entered. Must be between 1 and 6000 (inclusive). Only applies to Options with an :attr:`input_type` of :class:`str`. - autocomplete: Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]] - The autocomplete handler for the option. Accepts a a callable (sync or async) - that takes a single argument of :class:`AutocompleteContext` + autocomplete: Optional[Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]]] + The autocomplete handler for the option. Accepts a callable (sync or async) + that takes a single argument of :class:`AutocompleteContext`. :func:`discord.utils.basic_autocomplete` may be used to create the callable. .. note:: From 596951ef61cd3ed344e928da6c1ea3037c4a55e7 Mon Sep 17 00:00:00 2001 From: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> Date: Thu, 1 Feb 2024 22:41:05 -0600 Subject: [PATCH 7/7] Update discord/commands/options.py Co-authored-by: UK <41271523+NeloBlivion@users.noreply.github.com> Signed-off-by: Blue-Robin-Taken <86581171+Blue-Robin-Taken@users.noreply.github.com> --- discord/commands/options.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/discord/commands/options.py b/discord/commands/options.py index d1bf0e70bb..80d525c65b 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -144,7 +144,8 @@ class Option: autocomplete: Optional[Callable[[:class:`.AutocompleteContext`], Awaitable[Union[Iterable[:class:`.OptionChoice`], Iterable[:class:`str`], Iterable[:class:`int`], Iterable[:class:`float`]]]]] The autocomplete handler for the option. Accepts a callable (sync or async) that takes a single argument of :class:`AutocompleteContext`. - :func:`discord.utils.basic_autocomplete` may be used to create the callable. + The callable must return an iterable of :class:`str` or :class:`OptionChoice`. + Alternatively, :func:`discord.utils.basic_autocomplete` may be used in place of the callable. .. note::