This Discord bot was converted from the Idle Champions Code Redeemer browser extension. All browser extension code has been removed; only the Discord bot remains.
idle-code-redeemer/
├── README.md ← Start here
├── DEVELOPMENT.md ← Dev setup & architecture
├── MISE.md ← Optional: Mise tool management
├── LICENSE
├── .env.example ← Configuration template
├── .gitignore
│
├── src/
│ ├── bot/ ← Discord bot (ACTIVE)
│ │ ├── bot.ts ← Main Discord client & event handlers
│ │ ├── api/ ← Game server API client
│ │ ├── commands/ ← Slash command handlers (9 commands)
│ │ ├── database/ ← SQLite managers (users, codes, audit)
│ │ ├── handlers/ ← Message scanning for codes
│ │ └── utils/ ← Utilities (debug logging)
│ │
│ └── lib/ ← Type definitions (from game API)
│ ├── player_data.d.ts
│ ├── redeem_code_response.d.ts
│ ├── blacksmith_response.d.ts
│ ├── server_definitions.d.ts
│ └── chrome.d.ts ← Not used (kept for reference)
│
├── data/ ← SQLite database (git-ignored)
│ └── idle.db
│
├── debug/ ← API response logs (auto-cleanup) (git-ignored)
│ └── *.json
│
├── scripts/ ← Utility scripts
│ └── get-credentials.js
│
├── node_modules/ ← Dependencies (git-ignored)
├── package.json ← npm/Bun dependencies
├── tsconfig.json ← Global TypeScript config
├── tsconfig.bot.json ← Bot-specific TypeScript config
│
├── .mise.toml ← Mise task definitions (optional)
├── Dockerfile ← Docker container setup
├── docker-compose.yml ← Multi-container orchestration
└── .dockerignore
- src/bot/bot.ts - Discord client initialization, event handlers, command routing
- src/bot/api/idleChampionsApi.ts - Game server API client with query-parameter format
- src/bot/commands/setup.ts -
/setup user_id:<id> user_hash:<hash> - src/bot/commands/redeem.ts -
/redeem code:<code> - src/bot/commands/inventory.ts -
/inventory(gold, rubies, equipment, progress) - src/bot/commands/open.ts -
/open chest_type:<type> count:<count> - src/bot/commands/blacksmith.ts -
/blacksmith contract_type:<type> hero_id:<id> count:<count> - src/bot/commands/codes.ts -
/codes [count:<count>](view redeemed codes history) - src/bot/commands/makepublic.ts -
/makepublic code:<code>(share codes with other users) - src/bot/commands/redeempublic.ts -
/redeempublic [code:<code>](redeem shared codes) - src/bot/commands/help.ts -
/help
- src/bot/database/db.ts - SQLite connection & schema
- src/bot/database/userManager.ts - User credential storage
- src/bot/database/codeManager.ts - Code tracking & history
- src/bot/handlers/codeScanner.ts - Message scanning for codes (regex pattern)
- src/bot/utils/debugLogger.ts - API response logging with auto-cleanup
- .env.example - Template for environment variables
- .mise.toml - Task definitions for Mise (optional tool manager)
- package.json - npm scripts & dependencies
- tsconfig.bot.json - TypeScript compiler options
Production
discord.js- Discord bot frameworkdotenv- Environment variable loadernode-fetch- HTTP clientsqlite3- Embedded database
Development
typescript- Type checking@types/*- Type definitions
Runtime (managed by Mise or manual install)
bun1.0+ - JavaScript runtime (or Node.js 20+)
The following browser extension code has been permanently removed:
src/chestManagement/- Extension chest management UIsrc/inject/- Extension content scriptsrc/options/- Extension options pagesrc/service_worker/- Extension background service workersrc/shared/- Shared extension codeextension/- Extension manifest, assets, distribution files
Reason: Converted to Discord bot; extension code no longer needed.
For local development:
npm install
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run devFor Docker deployment:
docker-compose upFor production:
- Use Bun for 3-4x faster startup
- Configure
DISCORD_TOKENfrom Discord Developer Portal - Set
DISCORD_GUILD_IDto your server ID - Runs 24/7 in the cloud
See README.md and DEVELOPMENT.md for details.