1.3 KiB
1.3 KiB
Discord Bot Automation Research
Goal
Automate the creation of Discord bot applications and tokens programmatically.
Approaches
1. Discord REST API
Discord provides a REST API that can create applications/bots without browser automation.
Key Endpoints:
POST /applications/v2- Create a new applicationPOST /applications/{application.id}/bot- Add a bot user to an application
Authentication:
- User Account Token (from discord.com/login)
- Can be retrieved from browser local storage or by using Discord OAuth
2. Discord.js / Discord API Wrapper
Use Node.js libraries to interact with Discord's API:
@discordjs/restdiscord-api-types
3. Prerequisites
To create a bot application programmatically:
- Discord user account token (NOT a bot token - need an account token)
- The account must have 2FA enabled (Discord requirement for dev actions)
- Proper headers for user agent and authorization
Implementation Plan
- Extract Discord user token from the Discord credentials
- Use the Discord REST API to create a new application
- Add a bot user to the application
- Retrieve and return the bot token
- Update clawdbot.json with the new bot token
- Generate an OAuth2 invite link
Next Steps
- Test the Discord REST API approach
- Build a Node.js script for bot creation
- Integrate into Clawdbot workflow