# Discord Bot Setup

## Enabling the bot

The first step for the raffle creator is to add the bot to their discord server. To do this, click the `Add Bot To Server` link at the bottom right of the raffle creation page. [Or click this link](https://discord.com/oauth2/authorize?client_id=962140425332850729\&permissions=268594256\&scope=bot%20applications.commands) for your convenience.  *Note:* this link will request several permissions. You do not need to enable all of the permissions if you do not intend to use all of the features.

The video below walks you through the process of inviting the bot and setting up the channels along with permissions:

{% embed url="<https://www.youtube.com/watch?index=7&list=PLx1Z-oCPD5qmG8KTqi6b53HYz7qwjuT71&v=zqrzcpbMvRw>" %}

Below are the permissions needed for the different features of the bot. *Note: These permissions must be added at the Channel permissions for any channels the bot will post into and not just globally, as channel permissions in Discord will overwrite global permissions!*\
\
\- **Announcing Raffles, Winners, Reminders and Daily Launches**: `Send Messages,` `Embed Links,` `View Channel, Read Message History` \
\
\- **Tagging @everyone, @here, or @roles:**  `Mention Everyone, Read Message history`  \
\
\- **Creating winners roles and/or winners channels:** `Manage Channels` `Manage Roles`

## Announcing Raffles

*(This is also covered in* [Creating Your First Raffle](/alphabot/raffles/creating-your-first-raffle.md))

To tell the bot to announce a raffle, simply check the `Connect Bot` checkbox in the new raffle page, and select the channels to announce into. You can also optionally check the `Auto Announce` checkbox on, which will cause the bot to announce the raffle immediately after it is created.&#x20;

After the raffle is created, if it is connected to the discord bot, it will now have an option to `Announce to Discord` which can be used to trigger the announcement if you did not select to auto announce after raffle creation.

*Note: Announcement embeds will automatically update in Discord whenever a raffle is edited*

## Create Winners Role & Channel

The bot can be enabled to create a new role and automatically assign it to the users who won the raffle.  By providing a role name, and the necessary permissions of `Manage Roles` and `Manage Channels` it will create the role, assign it to the winners, and then create a channel with the same name, giving access to the raffle team and the users with the new role. A section ID can also be provided if you wish to have the channel created within a certain section in your Discord server.


---

# 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://alphabot-docs.gitbook.io/alphabot/the-bot/discord-bot/discord-bot-setup.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.
