From 2c55752524e69c86a194fc16cb52d4c2ce8fdbb3 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Thu, 19 Sep 2024 00:01:57 +0100 Subject: [PATCH] Test autocomplete --- worldtimezone/extensions/world_clock.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/worldtimezone/extensions/world_clock.py b/worldtimezone/extensions/world_clock.py index 827cad5..45b809f 100644 --- a/worldtimezone/extensions/world_clock.py +++ b/worldtimezone/extensions/world_clock.py @@ -14,7 +14,7 @@ @plugin.command @lightbulb.add_cooldown(5, 1, lightbulb.UserBucket) @lightbulb.option( - "timezone", "Your TimeZone", type=str, required=False, choices=world_clock_data.COMMON_TIMEZONES + "timezone", "Your TimeZone", type=str, required=False, autocomplete=True ) @lightbulb.command("set", description="Set your TimeZone", pass_options=True) @lightbulb.implements(lightbulb.SlashCommand) @@ -28,6 +28,11 @@ async def setIt(ctx: lightbulb.SlashContext, timezone: Optional[str] = None) -> await ctx.respond("Your TimeZone as been set!") +@setIt.autocomplete("timezone") +async def setIt_autocomplete_timezone(opt, inter): + return world_clock_data.COMMON_TIMEZONES + + @lightbulb.add_checks(lightbulb.human_only) @plugin.command @lightbulb.add_cooldown(5, 1, lightbulb.UserBucket)