How To Add Autocompletion To Your Discord Slash Commands

  Рет қаралды 15,386

Richard Schwabe

Richard Schwabe

Жыл бұрын

In this video we enable autocomplete on our application command options to give our users a better experience.
🔗 URLs 🔗
discordpy.readthedocs.io/en/s...
🗃️Github Project URL🗃️
- github.com/richardschwabe/dis...
🏆About this course🏆
My updated course: "How to make a discord bot" with discord.py 2.x covers everything you need to know to raise productivity and user activity on your discord server. By following this course you will learn everything you need to create a successful bot. Resulting in a professional, community driven and feature rich successful discord server.
The initial videos cover all necessary elements to create anything you want with discordpy, this includes:
- Registering a discord bot and inviting it to your server
- Setting up the python project with extra logging functionality
- Introduction to basic discordpy bot command structure
- Automatically load bot commands from separate files
- Handling user input with discordpy converters in a bot instance
- Handling errors during command execution
- Grouping commands together for better command organisation
- Creating discordpy COG (command collections)
- Loading COG extensions automatically from files
- Creating checks to limit access on bot commands
- DMs & "only you can see this" messages
- Hybrid commands to have both custom bot commands but also "SlashCommands"
- Dedicated Slashcommands
- Application commands in context menus for Members and Messages
- Decorators for Slashcommands
- Transform any user input in Slashcommands
- Handling autocompletion and filtering of Slashcommand user input
- Send rich text embeds with pictures, links and tables
- Create Views with Buttons for even better user interactions
- Showing Modals with Selects, TextInputs and Buttons
🎥Playlist 🎥
• How to create a DISCOR...
❤Community❤
To support the channel and see more tutorials about technologies:
👉LIKE & SUBSCRIBE to the channel:
kzbin.info_c...
👉Join us on our discord server: / discord
🌲My Linktr.ee 🌲
linktr.ee/richardschwabe
🗃️Code to my videos can be found on Github: github.com/richardschwabe
👉Comment below the video for feedback, suggestions, wishes or if you have spotted a mistake!
🏷️ Tags 🏷️
how to make a discord bot,python tutorial,discord bot,discord music bot,python discord bot,discord bot maker,discord py,best discord bots 2022,discordpy,discord bot client,create discord bot python,slash commands discord.py,discord py 2.0,create slash commands discord.py,discord.py slash commands,discordpy cogs,discord.py buttons, discord.py tutorial, discord.py tutorial 2023
© Created by Richard Schwabe with ❤ ©
Music License: KZbin Audio Library
Website: www.richardschwabe.de
All code examples fall under GNU General Public License v3.0
We do not recommend using code shown in tutorials or on our Github public repository to run in production environment and should be used for education only.
We cannot be held liable for any damage caused by the code or do not provide any warranty.

Пікірлер: 18
@eymenknx1004
@eymenknx1004 5 күн бұрын
Thanks a lot, I wanted to implement this feature on my bot and I searched a lot but could not find anything about it then I saw your video and oh God, it was a relief!
@AGuard
@AGuard Жыл бұрын
Your work helps me a lot thanks! Don't stop this
@asoniox
@asoniox 11 ай бұрын
Countless hours spent searching the internet and no results. This video summed up what I wanted to do perfectly. Thank you!
@almuaz
@almuaz Жыл бұрын
Thanks, i was stuck for hours.
@WilliamWonker
@WilliamWonker 3 ай бұрын
Thanks! The docs aren't the most helpful sometimes, this was excellent.
@ThatLadLegend
@ThatLadLegend 11 ай бұрын
How could I do this dynamically? Like to get the currently loaded cogs? Figured it out like 5 minutes later lmao.
@pointlesssssxddxdxd
@pointlesssssxddxdxd Жыл бұрын
i have a error "TypeError: issubclass() arg 1 must be a class". how can i fix that?
@Jonathannavaxd
@Jonathannavaxd Ай бұрын
I'm doing exactly the same thing as you and I can't get autocomplete on discord.
@narayan8778
@narayan8778 Жыл бұрын
How would you add 2 arguments where the options displayed for the second one are dependent on the choice of the first. Like first argument could be "state" and depending on that the second one displays the cities in that state .
@bubfusion
@bubfusion 3 ай бұрын
Did you ever figure it out? I'm trying to do the same thing
@InhaRelic
@InhaRelic 7 күн бұрын
@@bubfusion HELLO! late reply lmao So this depends a LOT on how you want to do it and the ammount of data you want to filter. The basic gist of it is to store outside of the command the `data` variable so, for example, lets say that the first field for me is "Character" and the second one is "Item" The first autocomplete will list all of the user's characters, and the second one will list the chosen character inventory by Item name, and we will asume that we already have the logic for both autocompletes to query this data. at the top of your file, over where your commands are but below where your intents (or cog class) you create a dict, lets call this "chosen_character", so, for example, self.chosen_character = {} Then, in the function that handles the first autocomplete, define "chosen_character" to the value of data, something like; self.chosen_character[user_id] = data[0].value if data else None and then in your second autocomplete, you call what you stored before using it; character_id = self.chosen_character.get(user_id, "value") This requires you to add to both functions the following at the begining: user_id = str(interaction.user.id) because otherwise it will store ONE character for everyone and if 2 users use the command at the same time it will break the second autocomplete for one of them. Also, you should reset the dict every time the command ends executing so that if someone goes directly to the second field, it doesnt keep the value of the last time they used the command. THIS IS JUST PROOF OF CONCEPT, literally did this since i saw this comments. There are probably much better ways to do this, and also it has the problem that when the command is written, chosen_character will always default to the first result on the query or the first item of the list, and if the user clicks on something on the list without writing, the bot has no idea it happened for some reason and the second autocomplete will filter/query based off the first item instead of what the user chose. Right now I think there might be a way to solve this listening to the interaction with an event handler? or maybe modifying the autocomplete to not show anything until its written, its up to you to decide what workaround works best
@justskiez9584
@justskiez9584 Жыл бұрын
Great video. Do you know how to add a description to an option?
@richardschwabe
@richardschwabe Жыл бұрын
The app_commands.Choice does not allow for a description, only localized names and values. However, the SelectOption has a description attribute.
@MrBossclub
@MrBossclub 11 ай бұрын
Can i use insted of items to load list from enum class event list? And load only 25 first and then of user try to type in something in the option, the bot will give new choice results based on matches in enum list?
@kukackis5051
@kukackis5051 7 ай бұрын
i belive if u breake the for loop at 25 items that should work
@CrunchySpon
@CrunchySpon Жыл бұрын
TypeError: unknown parameter given: item
@_Astro.Nish_
@_Astro.Nish_ Жыл бұрын
Even simple slash commands with Literals do autocomplete automatically without this. Why do we need separate autocomplete command?
@cheesecake19763
@cheesecake19763 Жыл бұрын
for example if you want to load data from a database which may be different every time you run the command or when searching the web via a command or sth
How to Permission Check Discord Slash Commands with Discord.py
4:31
Richard Schwabe
Рет қаралды 8 М.
Discord PAGINATION: All You Need to Know
10:38
Richard Schwabe
Рет қаралды 12 М.
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 19 МЛН
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 5 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 54 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
Select Menu Pagination Discord JS 13
5:46
Krazy Developer
Рет қаралды 1,1 М.
Setting up a discord.py 2 discord bot from scratch in python
8:24
Richard Schwabe
Рет қаралды 27 М.
6 Ways to Troll your Discord Friends (that don't exist)
7:42
No Text To Speech
Рет қаралды 1,1 МЛН
[NEW] Slash Commands in Less than 10 Minutes Using Discord.PY
5:55
Hack your brain with Obsidian.md
11:53
No Boilerplate
Рет қаралды 1,9 МЛН
Make a Discord Bot with Slash Commands
11:07
Ethan | The Code Syndicate
Рет қаралды 2,9 М.
$1 vs $100,000 Slow Motion Camera!
0:44
Hafu Go
Рет қаралды 23 МЛН
Сколько реально стоит ПК Величайшего?
0:37
PART 52 || DIY Wireless Switch forElectronic Lights - Easy Guide!
1:01
HUBAB__OFFICIAL
Рет қаралды 51 МЛН
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 32 МЛН
Cheapest gaming phone? 🤭 #miniphone #smartphone #iphone #fy
0:19
Pockify™
Рет қаралды 2,8 МЛН