Creating a bot

Getting started to pycord by creating a bot.

First of all, you need to install Pycord. You may learn how to install Pycord from the page below.

Once you install Pycord, we can get started on making our bot.

Making the bot

Just like how you needed to sign up to Discord to get started, we need to get your bot signed up too. To do this,

  1. Go to the Discord Developer Portal and click on New Application.

  2. Give your bot a name, and click Create.

  3. Now, you should see a page like this.

Our work is not done! Next, click on Bot tab on the left side of the screen.

Click on Add bot.

You can give it a name, change the Avatar, etc.

Inviting the bot

Now, lets get the bot added to some servers. Go to the OAuth2 tab in the left pane, and select bot and applications.commands as the scope.

The applications.commands scope allows the bot to use Slash Commands, which you might wanna have.

Next, we choose what permissions the bot will have. You can select them. For now, lets give your bot the Administrator permission, meaning the bot will have all the permissions.

Once you select the permissions, click on copy to get the bot invite link.

You can usr this invite link to invite your bots to servers.

Token

All accounts on Discord, may it be users or bots, have a "token". A token is a snowflake. You may be confused about tokens and slowflakes - but lets look at it another way.

Fun Fact Time: In real life, all snowflakes are unique. No two snowflakes have the same pattern.

The same way, we call this kind of unique things "snowflakes". So, whenever we talk about snowflakes, remember we are not talking about actual slowflakes, or ice, santa and whatnot.

Now, getting back to the topic, all bots on Discord have a token, which look like NzkyNzE1NDU0MTk2MDg4ODQy.X-hvzA.Ovy4MCQywSkoMRRclStW4xAYK7I . A token is essentially your bot's password; it's what your bot uses to login to Discord. However, your token is safe as long as you keep it with yourself.

Never leak your token. Tokens can give anyone access to your bot - they gain full control of it. Some common ways tokens get leaked are when you send your code to someone, push it to github, or use sites like replit to run your bot. A good way to prevent your token from getting leaked is by storing it in an env file. Read this article to learn how to do that.

You need to click on Copy and copy the bot's token.

Last updated