---
description: Getting started to pycord by creating a bot.
---

# Creating a bot

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

{% content-ref url="../master" %}
[master](../master)
{% endcontent-ref %}

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,&#x20;

1. Go to the [Discord Developer Portal ](https://discord.com/developers/applications)and click on `New Application`.
2. Give your bot a name, and click `Create`.
3. Now, you should see a page like this.

![](https://2961845821-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MjPk-Yu4sOq8KGrr_yG%2F-MjdW3OQnwUhacopqSWw%2F-Mjd_-mxrJCrzmaXrAg8%2Fimage.png?alt=media\&token=b8e2ae6c-2290-4d37-ad7c-eb412f3fb00e)

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

Click on `Add bot`.&#x20;

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.

![](https://2961845821-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MjPk-Yu4sOq8KGrr_yG%2F-Mk6tNY3LfDkjd6pqdpL%2F-Mk6tbeQLhJr2aopPb2S%2Fimage.png?alt=media\&token=234f7ae0-e6da-438c-ab44-7fda717d1cbd)

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.

![](https://2961845821-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MjPk-Yu4sOq8KGrr_yG%2F-Mk6tNY3LfDkjd6pqdpL%2F-Mk6tkdpddEWoa2jczZk%2Fimage.png?alt=media\&token=52c8a29f-a798-48f8-a8c7-4ecca2681f79)

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.&#x20;

{% hint style="danger" %}
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](https://towardsdatascience.com/using-dotenv-to-hide-sensitive-information-in-python-77ab9dfdaac8) to learn how to do that.
{% endhint %}

![](https://2961845821-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MjPk-Yu4sOq8KGrr_yG%2F-MjdbU12JISJorAZxrKH%2F-MjdbpUsapzb5n15Po5P%2Fimage.png?alt=media\&token=118e259f-940a-4f6c-b3a3-c29f3a54100d)

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





