> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langbot.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to Discord Bot

## Create Bot

Go to the [Discord Developer Portal](https://discord.com/developers/applications), log in, and create an application.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_01.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=ebc30ebdf0e0b7141ee20a129c75f593" alt="alt text" width="2464" height="1684" data-path="images/zh/deploy/bots/discord/discord_01.png" />

Modify the basic information, click `Save Changes` to save.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_02.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=a86cdc3aaf54e809c6e82ec6c23ea02c" alt="alt text" width="2484" height="1694" data-path="images/zh/deploy/bots/discord/discord_02.png" />

Click `Bot` on the left, click `Reset Token`, copy the generated Token.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_03.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=f5c5a49d96b03487ad025ed4430c4cfb" alt="alt text" width="2492" height="1712" data-path="images/zh/deploy/bots/discord/discord_03.png" />

And check all options in `Privileged Gateway Intents` on this page, click `Save Changes` to save.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_05.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=761e395e992fdc42a176dc9145c53ab4" alt="alt text" width="2090" height="844" data-path="images/zh/deploy/bots/discord/discord_05.png" />

**Finally, click `OAuth2` on the left, copy the `Client ID` on the page.**

## Connect to LangBot

Click to add a new bot, fill in the `Client ID` and `Token` obtained in the previous step into the configuration.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/connect_to_langbot.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=fbf794ccd2fcd11d3e4dbc79a89b9bdb" alt="alt text" width="1024" height="1304" data-path="images/zh/deploy/bots/discord/connect_to_langbot.png" />

<Warning>
  If you are using this adapter within mainland China, you may need to set up a network proxy.
</Warning>

After filling in, start LangBot. If configured successfully, the log will show `[02-02 16:48:15.263] manager.py (68) - [INFO] : Initializing platform adapter 1: discord`, keep LangBot running.

## Invite Bot to Server

You need to create a server first, then invite the bot to the server.

Go to the `OAuth2` page, select `URL Generator`, select `bot`, check the permissions as shown in the image.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_06.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=a6db470e5ff35c34f971119fcbf28fa6" alt="alt text" width="2054" height="1162" data-path="images/zh/deploy/bots/discord/discord_06.png" />

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_07.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=f4b8caf58e67c0517b904d27579cbb5d" alt="alt text" width="2018" height="1552" data-path="images/zh/deploy/bots/discord/discord_07.png" />

Click `Copy`, paste the generated URL into your browser to open it, and invite the bot to your server.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_08.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=574c56fb2b7c01441dd9f34f40016ca8" alt="alt text" width="848" height="1344" data-path="images/zh/deploy/bots/discord/discord_08.png" />

## Use Bot

Now you can use the bot normally in groups or private messages.

<img src="https://mintcdn.com/langbot/BZuGA47SaPPwv_j7/images/zh/deploy/bots/discord/discord_09.png?fit=max&auto=format&n=BZuGA47SaPPwv_j7&q=85&s=e4e34f6d279eddf3d66fa0d798cea701" alt="alt text" width="1304" height="480" data-path="images/zh/deploy/bots/discord/discord_09.png" />
