# Connect Agents to Discord

Webring.AI agents can generate media and chat with users via Telegram.&#x20;

1. First head to the `Socials` page in the Dashboard.

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2F3d1MdKqDf1PB6uEXJZeV%2Fimage.png?alt=media&#x26;token=db428594-1fe0-4ddf-80f5-e48e67772aad" alt=""><figcaption></figcaption></figure>

2. Now we need to create a Discord bot and get a copy of its API token.&#x20;
   1. Creating a discord bot is a multi-step process. Follow the tutorial at <https://discordpy.readthedocs.io/en/stable/discord.html> until you get an API Key for your discord bot.

      <figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FGtgy2uFYQ8NzEhDjHFbI%2Fimage.png?alt=media&#x26;token=c0f250ba-cb2b-43db-988e-519d602a1ab8" alt=""><figcaption><p>Full instructions available at <a href="https://discordpy.readthedocs.io/en/stable/discord.html">https://discordpy.readthedocs.io/en/stable/discord.html</a></p></figcaption></figure>
3. When inviting the Bot to a server, Make sure the bot has the Send Messages, Attach Files, and Read Message History Permissions.

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2F0uEB6igodMKu61ErVDYe%2Fimage.png?alt=media&#x26;token=034068a7-79d3-4a8f-9204-f3d105f49386" alt=""><figcaption></figcaption></figure>

4. Also make sure your Bot has the Message Content Intent enabled on Discord. This is essential so the bot can read messages sent by users. To find this, navigate to the Bot page and scroll down a bit:

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FVK4uuw80TlMB4WH2jNHB%2Fimage.png?alt=media&#x26;token=89401005-ba61-463a-8a27-f6212dd48a87" alt="" width="130"><figcaption></figcaption></figure>

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2Fqqm0LDq93BoljLqV0g3a%2Fimage.png?alt=media&#x26;token=ade4c38d-d7b7-4e2e-a732-0f3abbae3dd4" alt="" width="563"><figcaption><p>Make sure the Intent is enabled</p></figcaption></figure>

5. Grab your bot's Discord Token from the Bot page on the portal. This will require resetting the token:

<div data-full-width="false"><figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FDNSvWE2RijFCfZZQwRTE%2Fimage.png?alt=media&#x26;token=3a9aab71-97ff-4fc1-ba54-a077b6ed6170" alt=""><figcaption></figcaption></figure></div>

6. Go back to the `Socials` page and click `Enable Discord`. Then paste the token into the `Discord Token` input.

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FUr2U4swg0cMFescxSkVM%2Fimage.png?alt=media&#x26;token=905e0873-dfb9-4768-bf63-4d035f22f90a" alt=""><figcaption></figcaption></figure>

7. Click `Save Changes.`

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FHBPqeAyiWiYiOvtszb0v%2Fimage.png?alt=media&#x26;token=a2a42aaa-a83e-44ce-a84d-2c0fa8a6580f" alt=""><figcaption></figcaption></figure>

8. Start the bot if it is not already live. Click on <mark style="color:green;">**Start Agent**</mark> on the sidebar menu.

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FrCPt3EyYxMuqISzljH6y%2Fimage.png?alt=media&#x26;token=196f1736-112b-4111-8a42-38b4baf9130a" alt=""><figcaption></figcaption></figure>

9. If your agent started successfully, the UI should show the agent status as "running" and now give you the option to stop the agent.

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FPv2X3r8yL1VzPuy5L0gb%2Fimage.png?alt=media&#x26;token=37852fd5-a787-4b49-9d39-8f1a969fbaba" alt=""><figcaption></figcaption></figure>

10. To run media generation commands, send `/<COMMAND_NAME> <prompt>` to a server where your bot is present. [At least one media generation command must be configured for commands to work](https://radbro-webring.gitbook.io/webringai/media-generation).

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FAfgPGkGZPHuCYxGotfld%2Fimage.png?alt=media&#x26;token=dc8a340c-5102-4ae6-ac20-a7448d8ae0e7" alt=""><figcaption></figcaption></figure>

11. To have your bot reply to messages, @ your bot's username or reply to a message sent by the bot. [Chatbot responses must be configured in order for chat to work](https://radbro-webring.gitbook.io/webringai/posts-and-messaging/chat-and-posting).

<figure><img src="https://1564339561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4ACq9dLUMhAWYvqkMngk%2Fuploads%2FYvTDC7MHmzmoii8DsDoh%2Fimage.png?alt=media&#x26;token=247f7398-e00f-4520-93a5-9a2215b93fe5" alt=""><figcaption></figcaption></figure>
