# Bot Setup

## Application Creation

1. Go to the [Discord developer portal](https://discord.com/developers/applications)
2. Click on on the top right button "New Application"

   <figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FGvhtjaCWFgK0oecRVcK3%2Fimage.png?alt=media&#x26;token=f0a691fe-ee17-491c-bba3-7ea3f09d03d3" alt=""><figcaption><p>Discord Developer Portal﹣"New Application" Button</p></figcaption></figure>
3. In the modal, input a name in the "name" field, then click on the button "create"

   <div align="center"><figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FeF1iLpKHXmQeAcg2H9Km%2FScreen%20Shot%202022-10-16%20at%209.38.57%20AM.png?alt=media&#x26;token=5fe07a4e-9c5a-4253-bc65-ead4c4eacefc" alt="Discord Developer Portal﹣&#x22;Create an Application&#x22; Modal"><figcaption><p>Discord Developer Portal﹣"Create an Application" Modal</p></figcaption></figure></div>

## Application Customization

On the left, there is a sidebar menu which has an option "General Information"\
This is where you can customize the bot and add more information

<div align="center"><figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FDTk7nNf1GonrUDhDwWfC%2FScreen%20Shot%202022-10-16%20at%209.52.51%20AM.png?alt=media&#x26;token=5b8bfe96-9124-405d-9c7c-d351c7d50d82" alt="Discord Developer Portal﹣&#x22;General Information&#x22; Menu"><figcaption><p>Discord Developer Portal﹣"General Information" Menu</p></figcaption></figure></div>

## Bot Creation

1. Click on the menu "Bot"

   <div align="center"><figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FYEsaTZLYNJ4Xjsfbq8ZO%2FScreen%20Shot%202022-10-16%20at%209.59.48%20AM.png?alt=media&#x26;token=5059035e-b675-4990-82c0-3e7230c7eb1b" alt="Discord Developer Portal﹣&#x22;Bot&#x22; Menu"><figcaption><p>Discord Developer Portal﹣"Bot" Menu</p></figcaption></figure></div>
2. Click on the far right button "Add Bot"

   <div align="center"><figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FzVpGzAe8JgOPgDeMlVlH%2Fimage.png?alt=media&#x26;token=336ab715-f91a-46c1-ab72-66dff9644898" alt="Discord Developer Portal﹣&#x22;Add Bot&#x22; Button"><figcaption><p>Discord Developer Portal﹣"Add Bot" Button</p></figcaption></figure></div>
3. Scroll down to the sections "Privileged Gateway Intents", and turn all of them on

   <figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FwujAspW4mGPvq62CzMKO%2FScreen%20Shot%202022-10-16%20at%2010.05.23%20AM.png?alt=media&#x26;token=32a74e86-8918-4127-87c5-ee8662c931fb" alt="Discord Developer Portal﹣&#x22;Privileged Gateway Intents&#x22; Section"><figcaption><p>Discord Developer Portal﹣"Privileged Gateway Intents" Section</p></figcaption></figure>

{% hint style="warning" %}

### Requirement

Scratch for Discord does only work with all Privileged Gateway Intents allowed:

* PRESENCE INTENT
* SERVER MEMBERS INTENT
* MESSAGE CONTENT INTENT
  {% endhint %}

{% hint style="danger" %}

### Limitations

Once a bot exceeds 100 servers:

* An official verification from Discord is needed
  {% endhint %}

## Get the Token

1. Get the token by clicking on the button "Reset Token", then click on the button "Copy"

   <div align="left"><figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FFo7AKnXa0yw0cTxzH9nx%2FScreen%20Shot%202022-10-16%20at%2010.26.06%20AM.png?alt=media&#x26;token=559484da-f4a7-4e20-be07-cbd746cf5990" alt="Discord Developer Portal﹣&#x22;Token&#x22; Page"><figcaption><p>Discord Developer Portal﹣"Token" Page</p></figcaption></figure></div>

{% hint style="warning" %}
It is impossible to get an already created [token](https://docs.scratch-for-discord.com/use/toolbox/base#token):\
If you have lost it, you need to reset it
{% endhint %}

{% hint style="info" %}
To know how to use the [token](https://docs.scratch-for-discord.com/use/toolbox/base#token), check [#token](https://docs.scratch-for-discord.com/use/toolbox/base#token "mention")
{% endhint %}

## Bot Invitation

1. Go to the sidebar menu "OAuth2", then on the sub-menu "URL generator"

   <figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FVC33pTd54emGAbUA5zsa%2Fimage.png?alt=media&#x26;token=eb4c7ded-9c6c-4536-b64c-b00df0666c23" alt=""><figcaption></figcaption></figure>
2. Select the option "bot"

   <figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2FRC0PyfgjN424O4eG8i1D%2FScreen%20Shot%202022-10-16%20at%2010.58.43%20AM.png?alt=media&#x26;token=cf96b2bf-522b-4306-b862-e9b7c3d5c97c" alt=""><figcaption><p>once selected another menu will open</p></figcaption></figure>
3. Select the bot permissions you need *(Recommandation: for a private bot, choose Administrator)*

   <figure><img src="https://2077548579-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3xg7dEw96L10OHOz0yDz%2Fuploads%2F77izM0jw96OqCO8ZAFDy%2FScreen%20Shot%202022-10-16%20at%2011.01.34%20AM.png?alt=media&#x26;token=a9223eb8-7b3d-4181-bfec-3748048ba31f" alt=""><figcaption></figcaption></figure>
4. Below the permissions menu, browse to the URL
5. Invite the bot to the server you need

{% hint style="info" %}
Further information and official documentation:\
<https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scratch-for-discord.com/use/tutorial/bot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
