How To Make Discord Bot Using Python || Slash command & bot Status (2023)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello this is NYX I am busy in college and stuff so I decided to bring this channel alive with some useful tutorials on Discord bot but this is a pure discord.py bot no Forks are used so stay focused and let's begin open whatever browser you have and search for Discord click on the first link of disc [Music] c.com I have already logged into to Discord so you have to log in here now scroll down and search for developers then scroll a little you will see apps then click on get started then click application and now follow me [Music] this is going to be your bot's username choose whatever you like [Music] now click on reset the token you are not going to see this if you haven't enabled 2fa wait just a sec let me fill this [Music] up [Music] now copy the token and keep in mind this is a secret token you should never public it don't worry I have already reset it again so this token is no longer valid enable these options if not enabled you will run into error in the code let's invite your Bot in the Discord server click on ooth 2 to then URL generator then check these boxes for now I am giving my bot all the permissions for learning purposes you should to and then copy the link below and pass it in the new tab then invite the bot in your server [Music] here you can see my bot is in the server let's start the coding part I suggest you to use VSS code before writing the code let us install the discord.py package by typing this in the terminal pip install Discord just wait it will install all the library mine is already installed so it's showing requirement already [Music] satisfied let's start importing Discord [Music] libraries now we are done with the Imports then we will initialize our bot here I am creating a prefix for bot to use prefix commands just use whatever ever symbol or letter you want but this tutorial series is on/ commands but I will teach you how to create prefix [Music] commands then to connect with our bot we use that token we copied earlier and inside the client [Music] [Music] run now now we create the event it will tell us when the bot is [Music] [Music] ready as you can see it's telling us that print statement we just write in the on ready event with bot name it means our bot is connected and [Music] online this is the most basic structure of Discord bot let's create one prefix command unlike event we do not use parenthesis after event but we have to in commands so keep this in mind so the name of our Command is hello this is where we put the name of our [Music] Command and pass in CTX followed by colon then we await the response that bot will provide when we use that [Music] command look I run the bot again and by typing the prefix we have set with the command name we will get the response from bot if you want to change OT presense and add activity just follow [Music] [Music] me [Music] [Music] as you can see it changes his status and activity firstly we need to sync our slash or tree commands in on ready event now we create slash command to display ping latency of our bot it is similar to prefix command just some changes and you can also give this command a different name to [Music] display I will just keep the same and the description and instead of passing CTX we will pass interaction like this and follow the [Music] [Music] code lastly the await is simple just use interaction response send message and pass the message pong with variable we created [Music] that now we are done back to Discord just type slash and ping and enter boom it's [Music] working hey there thank you all for watching this tutorial I hope you liked it and comment down for more videos and ideas of new videos you want to learn about signing out oh
Info
Channel: nix404
Views: 11,748
Rating: undefined out of 5
Keywords: discord bot, how to make a discord bot in python, discord bot in python, python discord bot, how to make, discord bot series, discord bot setup, setup discord bot, how to setup a discord bot, python tutorial, how to change bot activity, how to change bot status, bot presence, Slash commands, discord bot 2023, How to use slash commands, How to make a Discord Bot using Python, How to make slash commands, how to host discord bot, discord.py slash commands, Discord.py tutorial
Id: LKm2NNR3FZk
Channel Id: undefined
Length: 13min 32sec (812 seconds)
Published: Thu Oct 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.