# 🤖 AskAvatar - Discord Moderator Bot Setup Guide

This guide walks you through setting up a self-hosted Discord Bot so your stream moderators can speak through your Avatar and control stream queues from a private Discord channel.

---

## 🛠️ Step 1: Create Your Discord Bot Application
1. Go to the **Discord Developer Portal**: [https://discord.com/developers/applications](https://discord.com/developers/applications)
2. Log into your Discord account.
3. Click the **"New Application"** button in the top right.
4. Name your bot (e.g., `AskAvatar Bot` or your stream name) and click **Create**.
5. *(Optional)* Upload an App Icon for your bot.

---

## 🔑 Step 2: Get Your Bot Token & Enable Intents
1. In the left sidebar of your application, click **"Bot"**.
2. Click **"Reset Token"** (enter your 2FA code if prompted) and click **Copy**.
   > ⚠️ **Keep this token secret!** Never share it publicly or show it on stream.
3. Scroll down to the **Privileged Gateway Intents** section:
   - ✅ **Message Content Intent**: Toggle **ON** (Required for the bot to read moderator commands).
   - Server Members Intent: OFF is fine.
   - Presence Intent: OFF is fine.
4. Click **Save Changes** at the bottom.

---

## 🌐 Step 3: Invite the Bot to Your Server
1. In the left sidebar, click **"OAuth2"** ➔ **"URL Generator"**.
2. Under **SCOPES**, check:
   - ✅ `bot`
3. Under **BOT PERMISSIONS**, check:
   - ✅ `View Channels`
   - ✅ `Send Messages`
   - ✅ `Read Message History`
   - ✅ `Add Reactions`
4. Copy the **Generated URL** at the bottom of the page.
5. Paste this URL into your browser, select your Discord server, and click **Authorize**.

---

## ⚙️ Step 4: Enable Developer Mode & Get Channel ID
1. In the Discord desktop app, click the **User Settings (⚙️ cog)** at the bottom left.
2. In the left sidebar, scroll down to the bottom and click **`</> Developer`** (right above Log Out).
3. Toggle **Developer Mode** to **ON**.
4. In your Discord server, create a **Private Text Channel** (e.g., `#askavatar-mods`).
5. Ensure your moderators and the bot have access to this channel.
6. Right-click the channel name and click **"Copy Channel ID"**.

---

## 🚀 Step 5: Connect in AskAvatar
1. In AskAvatar, open the **Integrations** tab.
2. Scroll to the **Discord Remote Control (Mod Bot)** card:
   - **Discord Bot Token**: Paste your token from Step 2.
   - **Channel ID**: Paste the channel ID from Step 4 (restricts commands to this channel).
   - **Command Trigger / Prefix**: Leave as `AskAvatar` (or set custom prefix like `!aa` or `!say`).
3. Click **"Connect Discord"**.
4. The status pill will turn **Connected (ON)**!

---

## 📜 Moderator Commands Reference
Moderators can use these commands in your designated channel:
- `!say [message]` (or `!aa [message]` or `AskAvatar [message]`): Speaks live through your Avatar on stream!
- `!pause`: Pauses the stream alert queue (useful when stepping away).
- `!resume`: Resumes the stream alert queue.
- `!skip`: Skips the currently playing alert.
- `!stop`: Emergency stop — immediately silences audio and stops playback.
- The bot reacts with a ✅ checkmark in Discord to confirm each command was executed.

Enjoy having your mods keep the stream lively! 🎉
