feat: add Discord bot integration
- Discord bot runs in background thread alongside desktop app - State synchronization between Discord and desktop waifu - Commands: !hello, !status - Responds to mentions and DMs - Complete setup guide in DISCORD_SETUP.md - Graceful fallback if no token configured 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
112
DISCORD_SETUP.md
Normal file
112
DISCORD_SETUP.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# Discord Bot Setup Guide
|
||||
|
||||
## Step 1: Create Discord Application
|
||||
|
||||
1. Go to https://discord.com/developers/applications
|
||||
2. Click "New Application"
|
||||
3. Name it (e.g., "Desktop Waifu")
|
||||
4. Click "Create"
|
||||
|
||||
## Step 2: Create Bot User
|
||||
|
||||
1. In your application, go to the "Bot" tab
|
||||
2. Click "Add Bot"
|
||||
3. Confirm by clicking "Yes, do it!"
|
||||
|
||||
## Step 3: Configure Bot Settings
|
||||
|
||||
### Bot Permissions
|
||||
Under the "Bot" tab:
|
||||
- Enable "MESSAGE CONTENT INTENT" (required to read messages)
|
||||
- Enable "SERVER MEMBERS INTENT" (optional, for member events)
|
||||
- Enable "PRESENCE INTENT" (optional, for presence updates)
|
||||
|
||||
### Bot Token
|
||||
1. Under "TOKEN", click "Reset Token"
|
||||
2. Copy the token (you'll need this for `.env`)
|
||||
3. **NEVER share this token publicly!**
|
||||
|
||||
## Step 4: Invite Bot to Your Server
|
||||
|
||||
1. Go to "OAuth2" > "URL Generator"
|
||||
2. Select scopes:
|
||||
- `bot`
|
||||
- `applications.commands`
|
||||
|
||||
3. Select bot permissions:
|
||||
- Send Messages
|
||||
- Read Message History
|
||||
- Use Slash Commands
|
||||
- Read Messages/View Channels
|
||||
- Embed Links
|
||||
- Attach Files
|
||||
|
||||
4. Copy the generated URL at the bottom
|
||||
5. Open it in your browser
|
||||
6. Select your server and authorize
|
||||
|
||||
## Step 5: Configure Application
|
||||
|
||||
1. Create `.env` file in project root:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
2. Edit `.env` and add your bot token:
|
||||
```
|
||||
DISCORD_BOT_TOKEN=YOUR_TOKEN_HERE
|
||||
```
|
||||
|
||||
## Step 6: Test the Bot
|
||||
|
||||
1. Run the application:
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
|
||||
2. In Discord, try these commands:
|
||||
- `!hello` - Bot will greet you
|
||||
- `!status` - Check waifu's current mood
|
||||
- `@BotName your message` - Mention the bot to chat
|
||||
- Send a DM to the bot
|
||||
|
||||
## Available Commands
|
||||
|
||||
- `!hello` - Say hello to the waifu
|
||||
- `!status` - Check current emotional state
|
||||
|
||||
## Features
|
||||
|
||||
### Automatic Responses
|
||||
The bot will respond to:
|
||||
- **Mentions** - When you @mention the bot in any channel
|
||||
- **DMs** - When you send a direct message to the bot
|
||||
|
||||
### State Synchronization
|
||||
The bot shares state with the desktop app:
|
||||
- Emotions sync between Discord and desktop
|
||||
- Conversation history is tracked
|
||||
- Interactions update the desktop waifu in real-time
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Bot doesn't respond
|
||||
- Check that MESSAGE CONTENT INTENT is enabled
|
||||
- Verify bot has "Send Messages" permission in the channel
|
||||
- Check console for error messages
|
||||
|
||||
### Bot won't start
|
||||
- Verify DISCORD_BOT_TOKEN is set in `.env`
|
||||
- Check that token is valid (not expired/reset)
|
||||
- Ensure discord.py is installed: `pip install discord.py`
|
||||
|
||||
### Bot joins but shows offline
|
||||
- This is normal for Python bots
|
||||
- They appear offline but will still respond to messages
|
||||
|
||||
## Security Notes
|
||||
|
||||
- **Never commit your `.env` file** to git (it's in `.gitignore`)
|
||||
- **Never share your bot token** publicly
|
||||
- If token is compromised, reset it in Discord Developer Portal
|
||||
- Keep the bot token secret like a password
|
Reference in New Issue
Block a user