[NEW] Slash Commands in Less than 10 Minutes Using Discord.PY

  Рет қаралды 117,363

Glowstik

Glowstik

Күн бұрын

Пікірлер: 244
@ZonkedOutTCM
@ZonkedOutTCM 2 жыл бұрын
first tutorial that actually worked in the end. i tried dozens of tutorials because i want the badge but didnt want to go the sketchy route and wanted to try to learn something while doing it. worked like a charm, and i ended up refreshing my memory of programming things as well , thanks! was fun!
@daephx
@daephx 2 жыл бұрын
Don't you ever call 'hello, world' a cliche. I will use that as a placeholder until the day I die!
@themightykhan3720
@themightykhan3720 Жыл бұрын
I get the print message that my commands are syncing, however nothing shows up on my server
@fahkyew7776
@fahkyew7776 9 ай бұрын
I printed the results of bot.tree.sync() and saw that both the commands I coded are, in fact, in the command tree, but when I type / in my test server, the slash commands I made don't appear. Any idea what might have gone wrong?
@MoneyThynker
@MoneyThynker 7 ай бұрын
same error
@DylanJava
@DylanJava 3 ай бұрын
For me I hit COMMAND & R (CTRL & R on Windows and Linux) to reload my discord.
@fahkyew7776
@fahkyew7776 3 ай бұрын
I should have thought to update this. If anyone has the same problem I had, all you need to do is restart Discord. For whatever reason, new slash commands don't appear until you restart the application.
@averageperson341
@averageperson341 Жыл бұрын
I copied exactly no errors but says 0 command(s) connected
@agnibhapal
@agnibhapal 9 ай бұрын
it works :D for the second time, first time it worked and then I forgot about this channel I did subscribe but I forgot the channel name, now I will remember it.
@mirzakurtovic5878
@mirzakurtovic5878 Жыл бұрын
Great tutorial! I have been struggling to understand the documentation so this really helped a lot. Just one question if you know, how do you make a parameter optional? Is there a flag for it or do you have to manually code the logic?
@rhenzduyag5868
@rhenzduyag5868 Жыл бұрын
kinda late but this might help you prompt: str=None put this on the method
@lukas5238
@lukas5238 2 жыл бұрын
Thanks Man now i can apply for the Developer Badge and create as many commands as i want for free. Keep it up
@clvrk8047
@clvrk8047 2 жыл бұрын
Good job dude, just jumping back into coding and was a bit rusty. Finally got around to updating my bot thanks to your video. Keep it up.
@Cacetinho_
@Cacetinho_ 11 ай бұрын
Thanks bro, nice tutorial! What theme do you use?
@glowstik
@glowstik 11 ай бұрын
monakai julia
@mcdondagd
@mcdondagd Жыл бұрын
how can I add a description to the command, like the ones below the command name when you go to slash commands. Also the ephemeral thing is what makes it only appear to the person who ran the command right EDIT: NVM I found it, and to anyone wondering the same thing, it's quite simple. you just change @bot.tree.command(name="[your command]") to @bot.tree.command(name="[your command]", description ="[whatever description you want]")
@ashrithathmaram7631
@ashrithathmaram7631 2 жыл бұрын
I'm getting "Attribute error: 'Bot' object has no attribute 'tree'
@mad3567
@mad3567 2 жыл бұрын
it's either something wrong with the discord.ext library, or how you used "commands.Bot" (see line 6 from the video) I couldn't replicate the problem, so if you send more info that'd help
@swodaw1247
@swodaw1247 2 жыл бұрын
@@mad3567 same thing happened to me, I replicated everything from the video.
@biplabchakraborty5014
@biplabchakraborty5014 Жыл бұрын
Use tree =commands.app_command(bot)
@flexnajnwsps
@flexnajnwsps Жыл бұрын
import the tree by in the on_ready thing put await bot.tree.sync()
@spinierkm4279
@spinierkm4279 10 ай бұрын
the / commands are saying its synced but the commands arent showing up when i type / any idea why?
@moeddl
@moeddl 7 ай бұрын
You have to give the roles on your Server Permissions. Go into your Settings of the Server and klick onto integrations and then onto your bot. There you will see your commands. You can add some roles there
@ProgrammerPenguin
@ProgrammerPenguin 11 ай бұрын
how does the ide tells you error as you're typing? like when you typed try: it said it must have an exception. is it a vscode extension or are you even using vscode?🤣
@M.Markovkin
@M.Markovkin 8 ай бұрын
Hey bro, thanks for this tutorial, but I need to enable the command only for one of my servers. How can I do it? How do I call a snowflake? Here's the string from the docs: guild (Optional[Snowflake]) - The guild to add the command to. If not given or None then it becomes a global command instead. I can't understand how to call a snowflake.
@badelbonillasimon4381
@badelbonillasimon4381 Жыл бұрын
thx u buddy this helped me to finish my bot. You teaches really good
@Comfy.
@Comfy. Жыл бұрын
Thank you so much bro this is an amazing tutorial! I've been trying to find videos that could help me and I finally found the one! You are such a talented programmer! Your tutorial was amazing and now my bot works now! Keep up the great work! Again, Thank you so much again!!!
@realferdimeiert
@realferdimeiert Жыл бұрын
Thank you for this tutorial, I had lots of problems with other videos but this one really helped.
@Izarden
@Izarden Жыл бұрын
AttributeError: 'Client' object has no attribute 'tree'....
@nargamer0
@nargamer0 3 ай бұрын
Try replace it to bot
@BeefOSRS
@BeefOSRS 6 ай бұрын
This was really short and to the point. Well done. Maybe include a paste bin of the example code for reference in the description
@NullableIsLive
@NullableIsLive Жыл бұрын
it gives me this error:Client does not have an application_id set. Either the function was called before on_ready was called or application_id was not passed to the Client constructor
@Jonarella
@Jonarella 2 жыл бұрын
I loved this tutorial... However "Hello World" shall never die lmaooo
@immortalsun
@immortalsun Жыл бұрын
Fantastic tutorial, thank you! Are you also using Copilot?
@glowstik
@glowstik Жыл бұрын
Yeah, thats how I got the code completion!
@dragonalley6443
@dragonalley6443 Жыл бұрын
hey quick question what if i want one of the options to open a drop down menu of options they can select?
@RVZWN
@RVZWN 2 жыл бұрын
It doesn t work for me, what version of discord or python do you need, youu need nextcord and not discord? Or Pycord? 0_o?
@glowstik
@glowstik 2 жыл бұрын
it requires discord.py 2.0
@RVZWN
@RVZWN 2 жыл бұрын
@@glowstik as soon as I wrote this I made it work on PyCharm... however I'm using a hosting platfom where my files are stored in there, but it doesn t work because now I see that my discord.py is v1.7.3... so that was the problem.. I want to change it but I don t know how..
@luucc_ss
@luucc_ss Жыл бұрын
what code editor do you use? it looks amazing!
@glowstik
@glowstik Жыл бұрын
Visual Studio Code and I've got the Julia Monakai Vibrant theme
@coding_guy
@coding_guy Жыл бұрын
NOTHING WORKED EXCEPT THIS TYSM
@benno0_0
@benno0_0 Жыл бұрын
the syncing part helped me alot! Thank you so much
@TechXSoftware
@TechXSoftware Жыл бұрын
I subbed, I like your vids. :D
@WiIIiamL
@WiIIiamL Жыл бұрын
God tier tutorial. Thanks so much!❤
@pitachu_s
@pitachu_s Жыл бұрын
Is it possible to build the command tree to sync using cogs ? That would be great to update commands with a list based arguments input.
@CYKLER
@CYKLER 2 жыл бұрын
it says "discord.ext.commands.errors.CommandNotFound: Command "hello" is not found and the hello command does not work
@SirRiceBurger
@SirRiceBurger 2 жыл бұрын
Thanks i was looking for a tutorial on this for so long and it finally helped.
@departition1169
@departition1169 2 жыл бұрын
Tysm, may I ask what compiler that you are using? It looks super nice
@glowstik
@glowstik 2 жыл бұрын
I'm using visual studio code as the editor and the Sublime Monakai by Aryan Ahire theme
@departition1169
@departition1169 2 жыл бұрын
@@glowstik tysm I didn't know dpy supported slash commands till somebody told me on discord. Glad I know how to add slash commands instead doing the old way
@PGCTalha
@PGCTalha Жыл бұрын
is it possible to still use embeds when using the slash commands, like you can with ctx?
@glowstik
@glowstik Жыл бұрын
yep, it works the same way also!
@FTYRL
@FTYRL Жыл бұрын
what app do u use for the prediction and that? is it vs code, is it pycharm like what is it
@glowstik
@glowstik Жыл бұрын
i use github copilot (which is paid) although there is tabnine which is free
@welshtony1
@welshtony1 Жыл бұрын
This actually worked but how do I get it to work with current commands in Cogs? Can't seem to get them to work
@coolgammathecat5693
@coolgammathecat5693 2 ай бұрын
unfortunately this didnt work for me because the commands dont show up
@kenezur
@kenezur Жыл бұрын
How do you connect this to the bot? Btw its really useful.
@glowstik
@glowstik Жыл бұрын
I just put in my bot token which I stored in another variable so it cant be stolen
@jc5947
@jc5947 Жыл бұрын
thanks for the tutorial!! Thank you very much for uploading this video ;)
@gavinthecrafter
@gavinthecrafter Жыл бұрын
Thank you for this tutorial! Do you know which intents this bot requires? I can't get the bot to work and I don't want to set all intents as that's very dangerous
@glowstik
@glowstik Жыл бұрын
yeah for slash commands alone you dpnt need any
@doctuh
@doctuh Жыл бұрын
i keep getting errors on line 14 ( except Exception as e: ) its saying invalid syntax... what should i do?
@krzechix2030
@krzechix2030 Жыл бұрын
Ayo what keyboard switches you got? they sound realll smooth
@glowstik
@glowstik Жыл бұрын
gatreon reds, just modded the case with some foam
@chillanomican
@chillanomican Жыл бұрын
can someone help me, I have installed discord with pip3 since pip doesnt work & it keeps saying it cant connect to discord when I click run
@drdonk_auf_die_1_xd
@drdonk_auf_die_1_xd Жыл бұрын
amazing tutorial, keep up the work bro
@PogoDigitalism
@PogoDigitalism Жыл бұрын
yo ty for this vid, littl equestion, how do i add descriptions to the commands and make them optional/required?
@glowstik
@glowstik Жыл бұрын
you can add a required=True to make it required and you can add command descriptions in the decorator.
@republicgamer6998
@republicgamer6998 Жыл бұрын
Thanks for your help, really helped me here I almost gonna scrap my code and move to pycord but any ideas about the cogs?
@glowstik
@glowstik Жыл бұрын
its pretty much the same thing, you can also just check their examples at github.com/Rapptz/discord.py/blob/master/examples/app_commands/basic.py
@chrissam6026
@chrissam6026 Жыл бұрын
What program are you using for this
@realKarlHealy
@realKarlHealy 2 жыл бұрын
help pls, I got an error: ImportError: cannot import name 'app_commands' from 'discord'
@worty32
@worty32 2 жыл бұрын
same here
@twguy69
@twguy69 Жыл бұрын
Thanks. Exactly what I needed.
@samarthd.n.2314
@samarthd.n.2314 Жыл бұрын
But how to categorize or create a sperate help command for the slash commands?
@svendiamond
@svendiamond 2 жыл бұрын
how did your slash commands work when you put an exclamation point as your command prefix?
@glowstik
@glowstik 2 жыл бұрын
i'm not using bot.command() and so I can use whatever prefix I want and it will still not work.
@gustavolondono8691
@gustavolondono8691 Жыл бұрын
Really great tutorial! Thank you very much!
@d3nt391
@d3nt391 Жыл бұрын
How would you access the context (ctx) in order to get things like discord attachments in a message? Thanks!
@glowstik
@glowstik Жыл бұрын
unfortunately, slash commands use interactions and not ctx so you would have to find work arounds to getting what you need through interactions.
@kibaofficial6332
@kibaofficial6332 Жыл бұрын
do you have also a video to remove a command again? i made a lot of bullshit yesterday in my code and want to remove some commands but i know that i have to do more then just delete them from the code
@glowstik
@glowstik Жыл бұрын
They should remove them selves if you delete it from the code, you can also manually delete it from the server settings
@kibaofficial6332
@kibaofficial6332 Жыл бұрын
@@glowstik oh sure true becaus when in start the bot the commands get new synced thanks man ^^'
@immortalsun
@immortalsun Жыл бұрын
@@glowstik For some reason, my commands stay even when rebooting the bot without the command code, and there’s no option to delete it in the integrations settings.
@zreplaysguides
@zreplaysguides 2 жыл бұрын
How to add a description to the command itself?
@glowstik
@glowstik 2 жыл бұрын
You can just use the description argument in the decorator
@zreplaysguides
@zreplaysguides 2 жыл бұрын
@@glowstik ye. Got it, thanks.
@므네모시네클랜기록보
@므네모시네클랜기록보 Жыл бұрын
How can I solve the error ValueError: 'activation comfirm' must be between 1-32 characters and contain only lower-case letters, numbers, hyphens, or underscores.
@glowstik
@glowstik Жыл бұрын
you can not have spaces in your slash command name
@eweeeer
@eweeeer 2 жыл бұрын
how to do it but instead of sending a message, it sends out the user avatar ?
@CrunchySpon
@CrunchySpon Жыл бұрын
I need help with smth. I wanna make a command that is a reminder, so it has to be responded to twice (1 time to confirm the reminder and the other one to actually remind the person.) but when it gets to the 2nd response it gives me the error: "InteractionResponded: This interaction has already been responded to before". Is there any way to fix this?
@BuddyWinteOfficial
@BuddyWinteOfficial 9 ай бұрын
Use channel = bot.get_channel(your channel id) and then use channel.send to send a second message.
@studiotutorial
@studiotutorial 8 ай бұрын
instead of using send_message again, use interaction.channel.send() and just mention
@Kaenzy.
@Kaenzy. 3 ай бұрын
Can you do with discord webhooks?
@glowstik
@glowstik 3 ай бұрын
alr did bro kzbin.info/www/bejne/rarWk6yffLOEfqc
@Kaenzy.
@Kaenzy. 3 ай бұрын
@@glowstik oh, thanks! Didnt saw, sorry
@fahnub
@fahnub Жыл бұрын
Thanks for this dawg
@metrowave_
@metrowave_ Жыл бұрын
For the first slash command I followed everything, but it says "(" was not closed. What can I do to fix it?
@junescript
@junescript Жыл бұрын
did you find a fix for this?
@Topher7lol
@Topher7lol 9 ай бұрын
so the ( must have a closing bracket, opposite to the first one, which would be )
@tiygar8548
@tiygar8548 Жыл бұрын
bro, is this vscode, if yes how did you make it fill the lines like that easily?
@glowstik
@glowstik Жыл бұрын
Yeah, I have github copilot so it helps me when coding by auto filling code that I might use.
@dawrrrr
@dawrrrr 4 ай бұрын
Was wondering if i could use an embed with this
@glowstik
@glowstik 4 ай бұрын
yeah you can, its just like any other message so you can do all the same things with it
@dawrrrr
@dawrrrr 4 ай бұрын
@glowstik I'm having a little trouble with it can u perhaps show me how 😅
@kenner__
@kenner__ Жыл бұрын
Why i have error - in interaction.response.send_message unknown parameter "interaction"? Please help!
@Topher7lol
@Topher7lol 9 ай бұрын
interaction must equal discord.Interaction (captial i)
@kenner__
@kenner__ 9 ай бұрын
@@Topher7lol niceee response after 7 months
@Rjjwsn
@Rjjwsn Жыл бұрын
theres no errors but if i do slash nothing shows up and if i put /hello or /say nothing came up
@circuitcoder
@circuitcoder Жыл бұрын
The program needs to be running while you try the command
@iam_sk_
@iam_sk_ Жыл бұрын
4:16 Work smarter not harder😂
@SapiPlays
@SapiPlays 2 жыл бұрын
Your auto fill for commands, How did you set that up? Can you tell us?
@glowstik
@glowstik 2 жыл бұрын
Thats automaticly built in to discord lol
@SapiPlays
@SapiPlays 2 жыл бұрын
@@glowstik I am talking about VS code. My VS code doesn't prompt codes like that
@glowstik
@glowstik 2 жыл бұрын
@@SapiPlays ohh, I use github copilot but you can also use tabnine.
@Keegan-T
@Keegan-T Жыл бұрын
is there a way to hide certain commands from users?
@MrBossclub
@MrBossclub Жыл бұрын
Hey can u help me to make slash commands in my scrip possible?
@kthefreak
@kthefreak 4 ай бұрын
it WORKED thanks a lot
@CrunchySpon
@CrunchySpon Жыл бұрын
Is there any variable for the message itself (like the "/hello" itself)?
@studiotutorial
@studiotutorial 8 ай бұрын
@app_commands.describe(var = "Variable)
@KonigTheV
@KonigTheV 4 ай бұрын
sooo helpfull❤
@kno_01
@kno_01 Жыл бұрын
you deserve a sub man
@carboi402
@carboi402 2 жыл бұрын
how did you get that italic f thing?
@jareimefilm8480
@jareimefilm8480 Жыл бұрын
Great video! Can you provide a documentary?
@fisti1208
@fisti1208 2 жыл бұрын
Is there a way to make describe with spaces? 'cause underlines and other stuff kinda sucks :c
@probablyalive6470
@probablyalive6470 2 жыл бұрын
since those are variable names, no
@studiotutorial
@studiotutorial 8 ай бұрын
womp womp
@rophil9551
@rophil9551 2 жыл бұрын
Why are we not using a wrapper like pycord or something
@glowstik
@glowstik 2 жыл бұрын
well it was quite asked for and dpy now has slash commands... also dpy is also a wrapper lmao
@stevehiatt534
@stevehiatt534 2 жыл бұрын
Very useful! Thanks
@phynae
@phynae Жыл бұрын
@app_commands.describe(thing_to_say = "Something") causes an error for me. TypeError: unknown parameter given: item_name
@Soap2morrow
@Soap2morrow Жыл бұрын
I’ve been looking for a tutorial on how to do slash commands for 2 months now. Thank you so much for making this video!! 😭
@ThatFoxiee
@ThatFoxiee 4 ай бұрын
when i add more commands, why don't they show up?
@glowstik
@glowstik 4 ай бұрын
They might take some time to show up, you can also try creating a sync command and running that to speed up the proccess
@ThatFoxiee
@ThatFoxiee 4 ай бұрын
@@glowstik I already fixed it, but thank you!
@The1AndOnii
@The1AndOnii Жыл бұрын
Object method can’t be used in „await“ expression
@n1klasli
@n1klasli Жыл бұрын
Wen haben wir denn da 😂
@The1AndOnii
@The1AndOnii Жыл бұрын
@@n1klasli kennen wir uns ?
@randompersongm
@randompersongm 3 ай бұрын
None of the commands are syncing
@pug3991
@pug3991 2 жыл бұрын
ITS ALIVE! (ty)
@animationsbelike
@animationsbelike 2 жыл бұрын
thank you so much! I guess with this you can get the new batch or i hope so! :) xd
@glowstik
@glowstik 2 жыл бұрын
you may have to wait 24h for it to register and also have a friend or alt run the command just to make sure you get it!
@animationsbelike
@animationsbelike 2 жыл бұрын
@@glowstik okay thank you! :)
@animationsbelike
@animationsbelike 2 жыл бұрын
for some reason i cant start the bot with bot.run("my token") do you know why? :)
@animationsbelike
@animationsbelike 2 жыл бұрын
edit: it works now! thank you so much :)
@Cometbolide
@Cometbolide Жыл бұрын
Hi, I use VSC and it says I cannot import app_commands from discord. Is there a reason why?
@glowstik
@glowstik Жыл бұрын
you may need to update discord.py
@Cometbolide
@Cometbolide Жыл бұрын
@@glowstik How would I do that?
@Cometbolide
@Cometbolide Жыл бұрын
​@@glowstik So, I tried updating it, but it doesn't work still.
@THEMASTER10121
@THEMASTER10121 Жыл бұрын
Same here. Tried updating it and still didnt work
@BlueBloodGamerz
@BlueBloodGamerz Жыл бұрын
is there way to make slash and prefix both work for command
@glowstik
@glowstik Жыл бұрын
you can use hybrid commands which would make the command both a slash and prefix command discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HybridCommand
@BlueBloodGamerz
@BlueBloodGamerz Жыл бұрын
@@glowstik can u tell me how can i embed smthing in slassh it just show
@fomy2176
@fomy2176 Жыл бұрын
Thanks so much !!
@a_programer
@a_programer Жыл бұрын
I LOVE YOU I FUCKING LOVE YOU FIRST TUTORIAL THAT ACTUALLY WORKS NOTHING ELSE WORKED NOT MY BRAIN NOT TUTORIALS NOT CHAT GPT BUT YOU DID THANK YOU
@shyzuko
@shyzuko Жыл бұрын
chatgpt :D
@BuilderDeveloper
@BuilderDeveloper 2 жыл бұрын
hey what's your vs code theme?
@glowstik
@glowstik 2 жыл бұрын
Sublime Monokai by Aryan Ahire
@BuilderDeveloper
@BuilderDeveloper 2 жыл бұрын
@@glowstik bro i wanna say to you one thing. you are amazing about that focus on yourself and go to 10k followers
@melchoir55
@melchoir55 2 жыл бұрын
Good video. Needs a github link with the completed code.
@dev_snips
@dev_snips Жыл бұрын
I had forgotten how to use arguments within my slash commands and couldn't find anybody explaining in a simple way. I really appriciate how this was explained and how simplified the code is compared to other people's tutorials. Very good job!
@yager400
@yager400 6 ай бұрын
Hi, it work but I don’t see the commands
@BigMemes-jd3tb
@BigMemes-jd3tb 11 ай бұрын
thanks bro ❤
@eIixi
@eIixi 5 ай бұрын
how about user commands?
@noodle69
@noodle69 Жыл бұрын
wow, thank you so much
@MIMI-oo5mz
@MIMI-oo5mz 8 ай бұрын
how did you make this "F"?
@CagierHorizon
@CagierHorizon Жыл бұрын
How do you make a subcommand using bot.tree.command()
@sharkkk2314
@sharkkk2314 Жыл бұрын
can I make the commands require prems?
@glowstik
@glowstik Жыл бұрын
Yep! Discord has a built in decorator for this, here are the docs with an example to get you started discordpy.readthedocs.io/en/stable/interactions/api.html#discord.app_commands.checks.has_permissions
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
Pdf to docx converter using python   ( i was bored )
1:49
What is mathematical thinking actually like?
9:44
Benjamin Keep, PhD, JD
Рет қаралды 31 М.
USA Olympiads || All Solutions || #maths
10:35
Learn with Christian Ekpo
Рет қаралды 250
AlmightyOptimizer 1.20.1 Fabric | ASIA BEST PLAYER
0:33
Triggered GamerX
Рет қаралды 131
[NEW] Host YOUR Discord Bot FOR FREE 24/7 | lunes.host
6:49