Prettier format pending files

This commit is contained in:
Builder.io 2025-11-09 22:40:19 +00:00
parent dd01fd30de
commit 2fa9f63763
2 changed files with 21 additions and 2 deletions

View file

@ -465,7 +465,9 @@ client.login(process.env.DISCORD_BOT_TOKEN).catch((error) => {
console.error(" 1. Token has been revoked by Discord");
console.error(" 2. Token has expired");
console.error(" 3. Token format is incorrect");
console.error("\n Solution: Get a new bot token from Discord Developer Portal");
console.error(
"\n Solution: Get a new bot token from Discord Developer Portal",
);
console.error(" https://discord.com/developers/applications");
}

View file

@ -1,12 +1,15 @@
# Discord Bot Token Invalid - Troubleshooting & Fix
## Problem
The Discord bot is failing to login with error:
```
❌ Unhandled Promise Rejection: Error [TokenInvalid]: An invalid token was provided.
```
This means the `DISCORD_BOT_TOKEN` environment variable is either:
- Expired or revoked
- Invalid/malformed
- For a bot that was deleted from Discord Developer Portal
@ -15,20 +18,24 @@ This means the `DISCORD_BOT_TOKEN` environment variable is either:
## Solution: Get a New Bot Token
### Step 1: Go to Discord Developer Portal
1. Visit: https://discord.com/developers/applications
2. Sign in with your Discord account
3. Click on the application named **"AeThex"** (or your app name)
### Step 2: Get the Bot Token
1. Click on the **"Bot"** tab on the left sidebar
2. Under the "TOKEN" section, click **"Reset Token"**
3. Click **"Yes, do it!"** to confirm (the old token will be revoked)
4. Click **"Copy"** to copy the new token
### Step 3: Update the Environment Variable
The new token looks like: `NTc4OTcxMjQ1NDU0OTUwNDIx.GxxxXX.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
**For Railway/Spaceship Deployment:**
1. Go to your Railway/Spaceship dashboard
2. Go to environment variables
3. Update or add: `DISCORD_BOT_TOKEN=<new_token_here>`
@ -36,6 +43,7 @@ The new token looks like: `NTc4OTcxMjQ1NDU0OTUwNDIx.GxxxXX.xxxxxxxxxxxxxxxxxxxxx
5. Redeploy the bot
**For Local Development:**
1. Update `.env` file in `code/discord-bot/`:
```
DISCORD_BOT_TOKEN=your_new_token_here
@ -43,7 +51,9 @@ The new token looks like: `NTc4OTcxMjQ1NDU0OTUwNDIx.GxxxXX.xxxxxxxxxxxxxxxxxxxxx
2. Restart the bot: `npm start`
### Step 4: Verify the Bot
After updating the token, the bot should:
1. Login successfully: `✅ Bot logged in as AeThex#xxxx`
2. Load all commands: `<60><><EFBFBD> Loaded command: verify`, etc.
3. Start health check server: `🏥 Health check server running on port 8044`
@ -51,6 +61,7 @@ After updating the token, the bot should:
## Token Format Validation
A valid Discord bot token:
- ✅ Starts with a number (user ID)
- ✅ Contains 3 parts separated by dots: `part1.part2.part3`
- ✅ Is ~70+ characters long
@ -61,14 +72,17 @@ Example: `NTc4OTcxMjQ1NDU0OTUwNDIx.Gv-kuN.MiaXTUhlTzCqsTdwhO8sbYci0lIIY5uC08O5Ug
## Common Issues & Fixes
### Issue: "Token has been exposed"
Discord automatically revokes tokens if they appear in public repositories (GitHub, etc.).
**Fix:** Reset the token in Discord Developer Portal as described above.
### Issue: Bot not in any servers
Even with a valid token, the bot might not connect to your servers.
**Fix:**
1. In Discord Developer Portal, go to **OAuth2 > URL Generator**
2. Select scopes: `bot`
3. Select permissions: `Administrator` (or specific permissions)
@ -76,12 +90,15 @@ Even with a valid token, the bot might not connect to your servers.
5. Select your server and authorize
### Issue: "TokenInvalid" but token looks correct
The token might be:
- Copied with extra whitespace
- Not fully copied (missing characters)
- From a different bot application
**Fix:**
**Fix:**
1. Go back to Discord Developer Portal
2. Reset the token again (this revokes the old one)
3. Copy the full new token carefully (no extra spaces)