DISCORD.PY TUTORIAL [POG] MAKE YOUR OWN DISCORD BOT!! [POG]
Today I will be teaching you some discord.py stuff. Its gonna be epiiccc!!
Lets get into it :))
Number one VERY IMPORTANT
Create an app then make bot.
Learn more here < pls go to that link its really important
Lets get started! Make a folder named
src, and create two files named:
Write the following code in
Yay you just imported those files from the
Lets go into the FUN stuff.
Oh wait nevermind, we need the
Create a file called
.env. Write this in your
IMPORTANT: IT DOESN'T HAVE TO BE IN THE FOLDER
If you do not know how to get your bot token go here.
Lets go in
bot.py, and setup our starter framework! Yes our prefix will be
Woah that was a lot
Lets break it down
- First, Gets token with
token = os.environ.get("token")
- Second, It defines
- Third, Creates the function
- Fourth, Checks if the
if message.author == client.user:
- Fifth, if the message starts with the command
~help, then do the following:
- Create the variable msg.
- Send the message.(
- Sixth, create the function
- Log the
- Run the commands on the bot.
and that was a lot to recover
- How do you send a message?
Answer: First define the
await (NOTE: MAKE SURE YOU ALWAYS HAVE THE
await) after that,
- How do you run the commands?
Keep Your Bot alive!
🎵 Stayin Alive 🎵
Add this into
Part Two: Adding More Commands
Now that bot is BORING, Lets add some more!
Random "Hello" message!
Deleting a Message
Alrighty, this is where some powers come in:
Your bot needs to have permissions! The way I do it is:
Make a bot
role. Give the bot role
administrator so they can delete messages.
You can give them permissions on your app! (AOUTH > that box at the buttom)
This can be most useful with
Check if the command is a actual command
We are going to have to add some stuff before we do this. Create a list with all the command names:
commands = ['hello', 'summon', 'delete'] #more commands
- How do you delete a message?
Answer: You must
Suggestions? Comments? PUT THEM IN THE COMMENTS!!!