rip_monsterz
๐Ÿ“Ž 1 file 4,609 chars
๐Ÿ“„
pasted-code-1772544946623.txt
txt 272 lines
โ–ถ
You are a senior backend + Discord bot developer with 5+ years of production experience.

Build a production-ready Discord earning bot using:

* Discord.js v14
* Node.js
* Express.js (for API)
* MongoDB (or PostgreSQL if structured)
* Secure token-based API system
* Environment variables for secrets

This bot is a professional earning ecosystem where users complete shortlinks and tasks to earn credits.

The bot must be scalable, secure, and modular.

---

## CORE FEATURES

1. ECONOMY SYSTEM

Currency name must be configurable in config file.

User fields:

* user_id
* balance
* total_earned
* total_withdrawn
* shortlinks_completed
* tasks_completed
* withdraw_count
* referral_count
* referrer_id
* daily_last_claim
* daily_streak
* risk_score
* is_blacklisted
* created_at

---

2. USER COMMANDS

Use Slash Commands.

โ€ข /balance (aliases: /bal, /wallet)
Shows:

* Balance
* Total Earned
* Withdrawn
* Shortlinks completed
* Tasks completed
* Referrals

โ€ข /daily

* 24 hour cooldown
* Configurable default daily reward
* Optional streak bonus
* Prevent claim if account age less than configured days

โ€ข /tasks
Shows interactive buttons:

* Shortlinks
* Offer tasks
* Manual tasks

Each task must:

* Generate unique tracking token
* Store pending session
* Prevent duplicate completion
* Respect cooldown
* Respect daily limit

โ€ข /referral
Shows:

* Personal referral link
* Referral count
* Lifetime commission percentage

Referral system:

* Configurable commission %
* Lifetime commission
* Prevent self-referral
* Detect suspicious mass referrals

โ€ข /withdraw
Flow:

1. Ask amount
2. Validate minimum withdraw
3. Validate balance
4. Ask method (UPI / Paytm / Crypto / Giftcard)
5. Create withdraw request
6. Deduct or freeze balance

---

3. ADMIN COMMANDS

Admin-only role configurable.

Economy control:

* /admin addcredits @user amount
* /admin removecredits @user amount
* /admin setcredits @user amount
* /admin resetuser @user

User tracking:

* /admin userstats @user
* /admin topwithdraws
* /admin toptasks
* /admin suspicious

Task management:

* /admin task create shortlink
* /admin task create joinserver
* /admin task create manual
* /admin task disable
* /admin task delete

Limits:

* /admin setlimit shortlink daily amount
* /admin setlimit shortlink cooldown minutes
* /admin setlimit task daily amount
* /admin setearningcap amount
* /admin setdaily amount
* /admin setwithdrawlimit amount
* /admin setwithdrawcooldown hours
* /admin setaccountage days
* /admin setvpnblock true/false

Security:

* /admin blacklist @user
* /admin unblacklist @user
* /admin freezeuser @user

---

4. AUTO CREDIT API SYSTEM

Build Express backend with:

POST /api/complete

Body:
{
user_id,
task_id,
token,
signature
}

Logic:

* Validate token exists
* Validate not already credited
* Validate signature secret
* Add reward
* Add referral commission
* Update stats
* Send log to Discord log channel
* Return JSON success response

Must include:

* Rate limit
* IP logging
* Replay protection
* Token expiration

---

5. ANTI ABUSE SYSTEM

Implement:

* IP hash logging
* Device fingerprint support
* Daily earning cap
* Daily shortlink limit
* Daily task limit
* Account age requirement
* VPN detection toggle
* Suspicious risk scoring system

---

6. CONFIG SYSTEM

config.json must contain:

* currency_name
* daily_reward_default
* referral_percentage
* withdraw_minimum
* shortlink_default_reward
* shortlink_daily_limit
* task_daily_limit
* earning_cap_daily
* admin_role_id
* log_channel_id
* api_secret_key

---

7. LOGGING SYSTEM

Create separate Discord log channel for:

* Task completed
* Credits added
* Withdraw request
* Referral bonus
* Admin actions
* Suspicious detection

---

8. PROJECT STRUCTURE

Follow clean architecture:

/commands
/events
/models
/routes
/services
/utils
/config
/index.js

Use async/await properly.
Use error handling middleware.
Use environment variables for sensitive data.

---

9. IMPORTANT RULES

* No hardcoded secrets
* No duplicate credit possible
* No negative balance allowed
* Fully modular code
* Production-ready structure
* Include comments
* Use secure validation

---

At the end:
Provide full project file structure and explanation.

This is a real earning bot intended for large-scale use (5,000+ users).

Make it optimized and secure.

---

END OF INSTRUCTIONS.
Kodari AI
KodariMar 3 at 1:40 pm 28,181 (v2)

Iโ€™ll create a production-ready Discord earning bot with complete anti-abuse protection, API system, and modular architecture.

DiscordEarningBot
A professional Discord earning ecosystem where users complete shortlinks and tasks to earn credits. Features include referral system with lifetime commissions, automated task verification API, comprehensive admin controls, anti-abuse protection with risk scoring, withdraw management, daily rewards with streaks, and complete logging. Built with Discord.js v14, Express.js, and MongoDB for scalability supporting 5000+ users.

โœ… Complete Production-Ready Discord Earning Bot Created

Files Created: 41 files

๐ŸŽฏ Core Features Implemented:

  1. Economy System - Full user tracking with balance, earnings, withdrawals, referrals

  2. User Commands - /balance, /daily, /tasks, /referral, /withdraw

  3. Admin Commands - 15+ admin commands for complete control

  4. API System - Express backend with signature verification and rate limiting

  5. Anti-Abuse - Risk scoring, IP logging, earning caps, daily limits

  6. Referral System - Lifetime commissions with abuse prevention

  7. Task Management - Create, disable, delete tasks with cooldowns

  8. Logging System - Complete Discord channel logging for all activities

  9. Security - Blacklisting, freezing, VPN detection, account age requirements

๐Ÿ“ Project Structure:

  • Modular architecture with separate services, commands, models

  • MongoDB with Mongoose for scalability

  • Express API with helmet and rate limiting

  • Discord.js v14 with slash commands

  • Complete error handling and validation

๐Ÿš€ Setup Instructions:

  1. Run npm install

  2. Copy .env.example to .env and add your credentials

  3. Update config.json with your Discord role/channel IDs

  4. Run npm start

The bot is production-ready for 5,000+ users with comprehensive security, scalability, and professional error handling.

rip_monsterz

add help command for user and admin both and add admin user only can use the admin commands.

Kodari can make mistakes. Review important code before using.
Files
commands
config
events
models
routes
services
utils
.gitignore
bot.js
config.json
index.js
package.json
README.md
server.js
Code
40 2,752
index.js
const connectDatabase = require('./config/database');
const { startBot } = require('./bot');
const { startServer } = require('./server');

async function main() {
  console.log('๐Ÿš€ Starting Discord Earning Bot...\n');

  await connectDatabase();

  startServer();

  await startBot();

  console.log('\nโœ… All systems operational!');
}

main().catch(error => {
  console.error('โŒ Fatal error:', error);
  process.exit(1);
});

process.on('unhandledRejection', (error) => {
  console.error('โŒ Unhandled promise rejection:', error);
});

process.on('uncaughtException', (error) => {
  console.error('โŒ Uncaught exception:', error);
  process.exit(1);
});