Skip to content

Latest commit

 

History

History
142 lines (109 loc) · 5.46 KB

File metadata and controls

142 lines (109 loc) · 5.46 KB

Project Structure

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.

Directory Layout

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

Key Files

Core Bot

Commands (9 slash commands)

Database

Auto Features

Configuration

Dependencies

Production

  • discord.js - Discord bot framework
  • dotenv - Environment variable loader
  • node-fetch - HTTP client
  • sqlite3 - Embedded database

Development

  • typescript - Type checking
  • @types/* - Type definitions

Runtime (managed by Mise or manual install)

  • bun 1.0+ - JavaScript runtime (or Node.js 20+)

Removed (Cleanup)

The following browser extension code has been permanently removed:

  • src/chestManagement/ - Extension chest management UI
  • src/inject/ - Extension content script
  • src/options/ - Extension options page
  • src/service_worker/ - Extension background service worker
  • src/shared/ - Shared extension code
  • extension/ - Extension manifest, assets, distribution files

Reason: Converted to Discord bot; extension code no longer needed.

Build & Deployment

For local development:

npm install
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run dev

For Docker deployment:

docker-compose up

For production:

  • Use Bun for 3-4x faster startup
  • Configure DISCORD_TOKEN from Discord Developer Portal
  • Set DISCORD_GUILD_ID to your server ID
  • Runs 24/7 in the cloud

See README.md and DEVELOPMENT.md for details.