A Discord selfbot that monitors the CTO.new invite sharing channel and automatically attempts to redeem invite codes when they're posted.
- Selfbots are against Discord's Terms of Service. Use at your own risk.
- This is for educational purposes. You're responsible for any consequences.
- The bot uses your Discord account, so make sure you understand the risks.
Make sure you have all the files in the cto-invite-scraper directory.
cd cto-invite-scraper
npm install- Open Discord in your web browser (not the app)
- Press
F12to open Developer Tools - Go to the
Networktab - Refresh the page or click around Discord
- Look for any request and find the
Authorizationheader - Copy the token (it starts with your user ID and contains dots)
- Go to cto.new and log in
- Press
F12to open Developer Tools - Go to the
Networktab - Try to redeem any invite code (even an invalid one)
- Look for the request to
api.enginelabs.ai/invites/redeem - Copy the
Bearertoken from theAuthorizationheader
The auth token expires after ~60 seconds, so the bot needs this cookie to refresh it automatically:
- With DevTools still open, go to
Applicationtab - Expand
Cookies→ click onhttps://cto.new - Find the
__clientcookie and copy its full value (it's a long JWT string) - Add to your
.env:CLERK_CLIENT_COOKIE=<value>
The bot will automatically refresh your auth token every 15 seconds using this cookie!
Create a .env file in the project root (copy from .env.example):
cp .env.example .envThen edit .env and add your tokens and cookie:
DISCORD_TOKEN=your_discord_token_here
CTO_AUTH_TOKEN=your_cto_auth_token_here
CLERK_CLIENT_COOKIE=your_clerk_client_cookie_here
Channel Configuration: The bot monitors these official CTO.new Discord channels by default:
1428387946293362789- invite-sharing channel1427788039144341584- general channel1427787585052344372- announcements channel
To monitor different channels, add to your .env:
CHANNEL_IDS=your_channel_id_1,your_channel_id_2,your_channel_id_3
Optional: Configure notifications (see Notifications section below)
Metrics: The bot automatically sends anonymous usage stats via Abacus:
installs: Incremented once when bot startsredeems: Incremented when an invite code is successfully redeemedactive: Incremented on success and every 30 minutes (heartbeat)
These metrics help track adoption and usage patterns. The data is completely anonymous (no personal info collected).
npm start- Connects to Discord using your account as a selfbot
- Monitors configured channels (defaults to official CTO.new invite-sharing, general, and announcements channels)
- Detects invite codes using regex pattern matching (12-character alphanumeric codes)
- Attempts redemption via CTO.new's API
- Logs all activity to the console with detailed status updates
- ✅ Real-time monitoring of Discord messages
- ✅ Smart invite code detection (filters out false positives)
- ✅ Automatic redemption attempts
- ✅ Duplicate code tracking (won't try the same code twice)
- ✅ Comprehensive error handling and logging
- ✅ Rate limiting between redemption attempts
- ✅ Graceful shutdown handling
- ✅ Advanced anti-obfuscation detection:
- Spaces and zero-width characters
- Discord markdown (spoilers, code blocks, bold, italic)
- Unicode normalization and combining marks
- Homoglyph mapping (Cyrillic, Greek, fullwidth lookalikes)
- Multi-strategy reconstruction (direct, spaced, line-wise, token-merge, full-scan)
- ✅ Flexible notifications:
- Success: When you successfully redeem a code
- Already Redeemed: When you find a code but someone beat you to it
- Token Issues: When your auth token needs attention
- Delivery methods: webhook, channel ping, or DM to user
- ✅ Clean console output with optional debug mode
The bot can notify you about important events:
- ✅ Success: Code redeemed successfully
⚠️ Already Redeemed: Found a code but someone got it first- 🔐 Token Issues: Auth token needs attention
Configure one of the following (choose a mode):
# notification mode: webhook | channel | dm | none
NOTIFY_MODE=webhook
# for webhook mode
NOTIFY_WEBHOOK_URL=https://discord.com/api/webhooks/<id>/<token>
# optional: ping a user in the webhook
NOTIFY_PING_USER_ID=123456789012345678
# for channel mode
NOTIFY_MODE=channel
NOTIFY_CHANNEL_ID=1428387946293362789
NOTIFY_PING_USER_ID=123456789012345678
# for dm mode
NOTIFY_MODE=dm
NOTIFY_DM_USER_ID=123456789012345678
Notes:
- If DMs fail with "Cannot send messages to this user", use webhook or channel mode instead.
- Webhook mentions use
<@USER_ID>with allowed mentions.
The bot provides detailed console output including:
- Connection status
- New messages detected
- Invite codes found
- Redemption attempt results
- Error messages and reasons
Example output:
Logged in as YourUsername#1234!
Monitoring channel ID: 1428387946293362789
Bot is ready and watching for invite codes...
New message in invite channel from SomeUser#5678: Check out this code: abc123def456
Found 1 potential invite code(s): ['abc123def456']
Attempting to redeem code: abc123def456
❌ Code abc123def456 already redeemed
Press Ctrl+C to stop the bot gracefully.
You can modify these settings in your .env file:
CHANNEL_IDS: Comma-separated list of Discord channel IDs to monitorNOTIFY_MODE: Notification method (webhook/channel/dm/none)DEBUG_MODE: Set totruefor verbose logging (token refreshes, health checks, metrics)
Advanced settings in bot.js:
inviteCodePattern: Regex pattern for detecting invite codes- Rate limiting delays
- API timeout settings
Make sure you've created the .env file and added your Discord token.
Make sure you've added your CTO.new authentication token to the .env file.
Your Discord token might be invalid or expired. Get a fresh token following the setup steps.
Your CTO.new auth token might be expired. Get a fresh token from the browser.
- Make sure you're in the correct Discord server
- Verify the channel ID is correct
- Check that your Discord account has access to the channel
This tool is provided as-is for educational purposes. Users are responsible for compliance with Discord's Terms of Service and any applicable laws or regulations.