From 87c1ef6e993844ee83492fd992ac4573f4576044 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Jan 2023 10:16:39 +0000 Subject: [PATCH 1/2] chore(deps): Bump ua-parser-js from 0.7.31 to 0.7.33 Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.31 to 0.7.33. - [Release notes](https://github.com/faisalman/ua-parser-js/releases) - [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md) - [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.31...0.7.33) --- updated-dependencies: - dependency-name: ua-parser-js dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index b58ebc87..00f84dfe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8904,9 +8904,9 @@ typescript@4.9.4: integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg== ua-parser-js@^0.7.30: - version "0.7.31" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6" - integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ== + version "0.7.33" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532" + integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw== unherit@^1.0.4: version "1.1.3" From 73809560405922a6705a2dbbf910e69e8e7c37cf Mon Sep 17 00:00:00 2001 From: Kavi Bidlack <104799865+kbidlack@users.noreply.github.com> Date: Sat, 11 Feb 2023 09:46:19 -0800 Subject: [PATCH 2/2] clean up autocomplete example (#281) --- .../application-commands/slash-commands.mdx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/interactions/application-commands/slash-commands.mdx b/docs/interactions/application-commands/slash-commands.mdx index 0d02dcf2..ad144509 100644 --- a/docs/interactions/application-commands/slash-commands.mdx +++ b/docs/interactions/application-commands/slash-commands.mdx @@ -214,12 +214,12 @@ bot.run("TOKEN") ## Autocomplete -Discord's autocomplete allows developers to determine option choices that are used in a slash command option. By defining a function, you can do this. +Discord's autocomplete allows developers to determine option choices that are used in a slash command option. You can do this by defining a function: ```py async def get_animal_types(ctx: discord.AutocompleteContext): """ - Here we will check if 'ctx.options['animal_type']' is and check if it's a marine or land animal and return specific option choices + Here we will check if 'ctx.options['animal_type']' is a marine or land animal and return respective option choices """ animal_type = ctx.options['animal_type'] if animal_type == 'Marine': @@ -228,7 +228,11 @@ async def get_animal_types(ctx: discord.AutocompleteContext): return ['Snake', 'Wolf', 'Lizard', 'Lion', 'Bird'] @bot.slash_command(name="animal") -async def animal_command(ctx: discord.ApplicationContext, animal_type: discord.Option(str, choices=['Marine', 'Land']), animal: discord.Option(str, autocomplete=discord.utils.basic_autocomplete(get_animals)): +async def animal_command( + ctx: discord.ApplicationContext, + animal_type: discord.Option(str, choices=['Marine', 'Land']), + animal: discord.Option(str, autocomplete=discord.utils.basic_autocomplete(get_animal_types)) +): await ctx.respond(f'You picked an animal type of `{animal_type}` that led you to pick `{animal}`!') ```