ROYAL CITY ROLEPLAY

PROJECT: TASKEARN PREMIUM TELEGRAM EARNING BOT

Build a complete, professional, secure, mobile-friendly Telegram earning bot named TaskEarn.

Telegram bot username: @TaskEarnNG25_Bot Platform: Telegram Country: Nigeria Currency: Nigerian Naira (NGN / ₦) Timezone: Africa/Lagos Programming language: Python Telegram library: python-telegram-bot Database: SQLite for development, with a migration path to PostgreSQL for production.

IMPORTANT: Generate a complete, runnable project with actual backend logic. Do not provide pseudocode, fake functionality, or a design-only demonstration. If you cannot implement a feature completely, clearly explain what is missing.

  1. PREMIUM BRANDING AND DESIGN

Give TaskEarn a polished, modern, professional appearance.

Use:

  • Attractive Telegram inline keyboards.
  • Clear button labels and organized menus.
  • Professional welcome messages.
  • Consistent formatting and emojis.
  • Well-formatted wallet and transaction displays.
  • Clear success, error, loading, and confirmation messages.
  • Mobile-friendly navigation.
  • Helpful instructions for new users.

Welcome message:

"πŸŽ‰ Welcome to TaskEarn!

Earn rewards by completing available tasks, inviting eligible friends, and claiming your daily bonus.

πŸ’° Track your earnings in your wallet. 🎯 Complete tasks and earn rewards. πŸ‘₯ Invite friends and earn referral bonuses. 🎁 Claim daily rewards. 🏦 Request withdrawals on the 25th of each month.

Start earning responsibly with TaskEarn!"

Main menu buttons:

  • 🏠 Home
  • 🎯 Earn Tasks
  • 🎁 Daily Bonus
  • πŸ‘₯ Refer & Earn
  • πŸ’° My Wallet
  • 🏦 Withdraw
  • πŸ“œ Transaction History
  • πŸ’Ž VIP Membership
  • πŸ“’ Announcements
  • ❓ Help & Support

Use pagination when lists become long. Include Back and Home buttons throughout the interface.

  1. USER REGISTRATION AND ACCOUNTS

When a user starts the bot:

  • Create a unique user account using their Telegram ID.
  • Save their Telegram username, first name, registration date, and account status.
  • Prevent duplicate accounts.
  • Support referral links such as /start REFERRER_ID.
  • Validate referral information on the server.
  • Prevent users from referring themselves.
  • Prevent duplicate referral rewards.
  • Track referral eligibility and reward status.
  • Provide an account summary and help menu.
  • Respect privacy and collect only necessary information.

Do not request Telegram login codes, passwords, banking PINs, or OTPs.

  1. TASK EARNING SYSTEM

Create a working task management system.

Task categories may include:

  • Social media engagement tasks.
  • Website visits.
  • Surveys.
  • Promotional activities.
  • Other legitimate tasks configured by the administrator.

Each task must contain:

  • Unique task ID.
  • Task title and description.
  • Instructions.
  • Reward amount in NGN.
  • Task type.
  • Optional proof requirements.
  • Start and end dates.
  • Maximum number of participants, if applicable.
  • Active or inactive status.

User workflow:

  1. Open Earn Tasks.
  2. View available tasks and rewards.
  3. Select a task.
  4. Read the instructions.
  5. Submit the required proof if applicable.
  6. Receive a confirmation that the submission is pending review.
  7. Receive a notification when the task is approved or rejected.

Admin workflow:

  • Create tasks.
  • Edit tasks.
  • Pause and resume tasks.
  • Delete or archive tasks.
  • Set reward amounts and limits.
  • Review submissions.
  • Approve or reject submissions with a reason.
  • Credit rewards exactly once after approval.

Implement duplicate-submission prevention, input validation, task limits, and audit logs.

Never automatically claim a task was completed when it has not been verified. Do not reward fake engagement, spam, or fraudulent activity.

  1. DAILY BONUS SYSTEM

Create a daily reward feature.

Requirements:

  • Allow eligible users to claim a reward once every 24 hours.
  • Store the last successful claim in the database.
  • Enforce cooldowns on the server.
  • Make reward amounts configurable by the administrator.
  • Prevent duplicate claims caused by repeated button presses or concurrent requests.
  • Record each successful claim in the transaction ledger.
  • Show the next eligible claim time.
  • Notify users when a claim succeeds or is not yet available.

Do not reset the cooldown simply because the bot restarts.

  1. REFERRAL AND INVITE SYSTEM

Generate a unique referral link for every eligible user.

Users must be able to:

  • Copy or share their referral link.
  • See the number of people who joined through the link.
  • See how many referrals are eligible.
  • View referral rewards earned.
  • Track pending referral rewards.

Admin settings must include:

  • Referral reward amount.
  • Eligibility requirements.
  • Minimum qualifying activity, where appropriate.
  • Maximum rewards per user, if desired.
  • Referral campaign activation or deactivation.

Security:

  • No self-referrals.
  • No duplicate rewards.
  • No reward for repeated registration by the same Telegram account.
  • Flag suspicious activity for administrator review.
  • Credit rewards only after all configured eligibility conditions are satisfied.
  1. WALLET AND TRANSACTION LEDGER

Implement a secure wallet for every registered user.

The wallet must display:

  • Available balance.
  • Reserved balance.
  • Lifetime earnings.
  • Total rewards.
  • Total withdrawals paid.
  • Pending withdrawal amount.

Use NGN formatting, for example ₦1,500.00.

Every balance change must create a transaction record containing:

  • Transaction ID.
  • User ID.
  • Transaction type.
  • Amount.
  • Previous balance.
  • New balance.
  • Description.
  • Timestamp.
  • Related task, bonus, referral, or withdrawal ID where applicable.
  • Transaction status.

Use database transactions to ensure that balances and ledger entries remain consistent.

Do not allow users to edit their own balances. Prevent negative balances, duplicate credits, and race conditions.

  1. CRITICAL WITHDRAWAL RULE: ONLY THE 25TH

Users may submit withdrawal requests ONLY on the 25th day of each calendar month, using the Africa/Lagos timezone.

This is a strict business rule and must be enforced by the backend.

Examples:

  • 24th of the month: Reject new withdrawal requests.
  • 25th of the month: Allow eligible requests.
  • 26th of the month: Reject new withdrawal requests.
  • Every other day: Reject new withdrawal requests.

Requirements:

  1. Check the actual current date using the Africa/Lagos timezone.
  2. Enforce the date rule on every withdrawal request in the backend.
  3. Do not rely on hiding or disabling a button as the only restriction.
  4. Show users the next withdrawal date when the window is closed.
  5. Make the minimum withdrawal amount configurable. Use ₦1,000 as the initial default.
  6. Reject amounts below the minimum.
  7. Reject requests that exceed the user's available balance.
  8. Prevent duplicate pending withdrawal requests when inappropriate.
  9. Reserve the requested amount atomically so the user cannot spend it twice.
  10. Store each request with a unique withdrawal ID.
  11. Support Pending, Approved, Rejected, and Paid statuses.
  12. Notify users when the withdrawal status changes.
  13. If a request is rejected, restore the reserved funds exactly once.
  14. Do not mark a withdrawal as Paid until the payment has actually been confirmed.
  15. Prevent duplicate payment processing.
  16. Record payment references, administrator actions, timestamps, and reasons.
  17. Display withdrawal history to users.
  18. Provide administrators with pending withdrawal totals and outstanding liabilities.

Withdrawal instructions displayed to users:

"🏦 TaskEarn Withdrawals

Withdrawal requests are accepted ONLY on the 25th of each month.

Minimum withdrawal: ₦1,000.

Your request is subject to balance verification and review. Payment is not guaranteed merely because a request was submitted.

Please check your wallet and withdrawal history for updates."

Use a reliable timezone-aware implementation. Include automated tests proving that requests are rejected on the 24th and 26th and accepted on the 25th when all eligibility requirements are met.

  1. PAYMENT AND PAYOUT MANAGEMENT

Build a safe payout workflow.

Initially support administrator-managed payments:

  • User submits a valid withdrawal request.
  • Admin reviews the request.
  • Admin approves or rejects it.
  • An authorized administrator makes the actual payment using the configured payment method.
  • Admin records a valid payment reference after verifying the transfer.
  • The system marks the withdrawal Paid only after verification.
  • User receives a notification.

Do not claim that the bot can send automatic bank transfers without a configured, supported payment provider and the required credentials.

If an automatic payout provider is later integrated:

  • Use the provider's official API.
  • Store credentials securely in environment variables.
  • Verify webhook signatures.
  • Handle retries and duplicate events safely.
  • Use idempotency keys where supported.
  • Log payment results without exposing sensitive credentials.

Never store users' banking PINs, card PINs, OTPs, or banking passwords.

  1. VIP MEMBERSHIP SYSTEM

Create a configurable VIP membership section.

Possible features:

  • VIP status.
  • Membership expiry date.
  • Membership benefits.
  • Membership purchase history.
  • Admin-controlled membership plans.
  • Configurable pricing in NGN.
  • Automatic expiry checks.
  • Upgrade and renewal notifications.

Important:

  • VIP must not be required to access ordinary bot functions unless explicitly configured.
  • Do not invent benefits that have not been configured.
  • Do not activate a paid membership until payment is verified.
  • Do not display fake payment confirmations.
  • If no payment provider is configured, allow the administrator to manage membership manually and explain that automatic purchases are not yet available.
  1. ADMIN DASHBOARD

Restrict all administrative functions to Telegram user IDs explicitly configured in an ADMIN_IDS environment variable.

Never trust a username or a button alone to establish administrator permission.

Provide these features:

USER MANAGEMENT

  • View registered users.
  • Search by Telegram ID.
  • View account status and registration date.
  • View user balances and transaction history.
  • Suspend and reactivate accounts.
  • Review suspicious activity.
  • Record administrative actions.

TASK MANAGEMENT

  • Add, edit, pause, resume, and archive tasks.
  • Set rewards and task limits.
  • Review task submissions.
  • Approve or reject submissions.
  • Prevent duplicate task rewards.

REWARD MANAGEMENT

  • Configure daily bonus amounts.
  • Configure referral rewards.
  • Set eligibility requirements.
  • View reward history.
  • Prevent unauthorized balance adjustments.

WITHDRAWAL MANAGEMENT

  • View pending requests.
  • Filter by status and date.
  • Approve or reject requests.
  • Record rejection reasons.
  • Record verified payment references.
  • Mark requests Paid only after payment verification.
  • Export withdrawal reports.
  • View pending withdrawal liabilities.

DASHBOARD STATISTICS

  • Total registered users.
  • Active users.
  • New users today.
  • Total tasks and submissions.
  • Approved task rewards.
  • Referral rewards.
  • Daily bonuses paid.
  • Available wallet balances.
  • Pending withdrawal requests.
  • Approved but unpaid withdrawals.
  • Total confirmed payouts.

SETTINGS

  • Minimum withdrawal amount.
  • Daily bonus amount.
  • Referral reward amount.
  • Task reward defaults.
  • VIP plans.
  • Task availability.
  • Announcement settings.

Require confirmation for destructive or financially significant actions. Log all administrative actions with the administrator's Telegram ID, action, target, timestamp, and result.

  1. BROADCAST AND ANNOUNCEMENT SYSTEM

Create a working administrator-only broadcast system.

Admin commands:

  • /broadcast
  • /stats
  • /admin
  • /addtask
  • /withdrawals
  • /settings

Broadcast workflow:

  1. Administrator opens the broadcast feature.
  2. Administrator enters a message.
  3. Bot shows a preview.
  4. Administrator chooses Confirm or Cancel.
  5. Only an authorized administrator can confirm.
  6. Bot sends the message to registered users who have not blocked the bot.
  7. The system handles Telegram rate limits and temporary errors.
  8. The bot records delivery attempts and reports successes and failures.
  9. The broadcast is stored in the database with its creator and timestamp.

Never allow ordinary users to trigger administrator broadcasts. Do not repeatedly send messages to users who have blocked the bot.

  1. TRANSACTION HISTORY AND NOTIFICATIONS

Users must be able to view:

  • Task rewards.
  • Daily bonuses.
  • Referral rewards.
  • Withdrawal requests.
  • Withdrawal rejections and refunds.
  • Confirmed payments.
  • VIP membership events.

Provide pagination and readable timestamps in Africa/Lagos time.

Send notifications for:

  • Successful task reward.
  • Approved or rejected task.
  • Daily bonus claim.
  • Referral reward.
  • Withdrawal request received.
  • Withdrawal approved or rejected.
  • Withdrawal marked Paid after confirmation.
  • Important administrator announcements.

Do not send duplicate notifications unnecessarily.

  1. DATABASE STRUCTURE

Use a persistent database with appropriate indexes, constraints, and foreign keys.

Include tables for:

  • users
  • tasks
  • task_submissions
  • referrals
  • transactions
  • daily_bonus_claims
  • withdrawals
  • vip_memberships
  • announcements
  • broadcast_logs
  • settings
  • admin_audit_logs

Use unique constraints and database transactions to prevent duplicate accounts, referral rewards, task rewards, bonus claims, and payments.

Provide database initialization and schema migration instructions.

Do not rely on temporary in-memory storage for balances, users, tasks, or withdrawal records.

  1. SECURITY AND ERROR HANDLING

Implement:

  • Environment-based secrets.
  • Server-side authorization.
  • Input validation.
  • Parameterized SQL queries.
  • Secure balance updates.
  • Duplicate-action prevention.
  • Rate limiting where appropriate.
  • Safe error messages.
  • Structured logging.
  • Graceful handling of network failures.
  • Protection against unauthorized callbacks.
  • Persistent storage.
  • Database backup guidance.
  • No hardcoded bot token.
  • No secrets in logs or error messages.

Use a ".env.example" file containing placeholders only. Do not create a real token or invent administrator IDs.

Never ask the user to paste their bot token publicly. Instruct the project owner to configure secrets privately on the hosting platform.

  1. COMMANDS

Implement and document:

  • /start β€” register or open the main menu.
  • /help β€” explain bot features.
  • /wallet β€” show wallet balances.
  • /earn β€” display available tasks.
  • /daily β€” claim the daily bonus.
  • /refer β€” show the referral link and statistics.
  • /withdraw β€” open the withdrawal workflow.
  • /history β€” show transaction history.
  • /admin β€” open the admin dashboard for authorized administrators.
  • /stats β€” show administrator statistics.
  • /broadcast β€” open the protected broadcast workflow.

Configure Telegram command-menu entries and ensure every command performs its intended backend action.

  1. PROJECT FILES AND DEPLOYMENT

Generate a complete project with a clear directory structure.

Include:

  • main.py or an appropriately organized application entry point.
  • Separate modules for handlers, database access, wallet logic, tasks, referrals, withdrawals, VIP memberships, and administration where useful.
  • requirements.txt.
  • .env.example.
  • README.md.
  • Database initialization and migration scripts.
  • Automated tests.
  • Logging configuration.
  • Deployment instructions.
  • A health-check mechanism if appropriate for the hosting environment.

Explain how to:

  1. Install dependencies.
  2. Configure the bot token privately.
  3. Set administrator Telegram IDs.
  4. Initialize the database.
  5. Run the bot locally.
  6. Test all major features.
  7. Deploy to a suitable persistent hosting service.
  8. Keep the bot running reliably.
  9. Back up and restore the database.
  10. Update the application safely.

Do not recommend a hosting setup that loses the database whenever the application restarts.

  1. AUTOMATED TESTING

Write runnable automated tests for:

  • New user registration.
  • Duplicate registration prevention.
  • Referral tracking.
  • Self-referral rejection.
  • Duplicate referral reward prevention.
  • Task submission and approval.
  • Duplicate task reward prevention.
  • Daily bonus cooldown.
  • Concurrent wallet updates.
  • Negative balance prevention.
  • Withdrawal rejected on the 24th.
  • Withdrawal accepted on the 25th when eligible.
  • Withdrawal rejected on the 26th.
  • Withdrawal date evaluated in Africa/Lagos timezone.
  • Minimum withdrawal enforcement.
  • Insufficient balance rejection.
  • Funds reserved correctly.
  • Rejected withdrawals refunded exactly once.
  • Duplicate payment prevention.
  • Administrator authorization.
  • Unauthorized broadcast rejection.
  • Broadcast failure handling.

Use a controllable clock in tests so date-specific withdrawal rules can be tested reliably.

  1. FINAL DELIVERY REQUIREMENTS

Produce the complete source code and all required files.

First show the project directory structure. Then generate the contents of each file.

Ensure imports, dependencies, database operations, callback handlers, and commands are consistent with one another.

Do not omit essential files or replace implementations with phrases such as "add code here."

Explain all environment variables and setup steps.

Run the automated tests if your environment supports execution, and report which tests actually passed or failed. Do not claim tests were run if they were not.

Clearly distinguish implemented features from features that still require external credentials, real payment-provider integration, deployment, or manual configuration.

The goal is to build TaskEarn as a professional, secure, maintainable Telegram earning platform with premium presentation, genuine earning features, a protected administrator dashboard, and withdrawals strictly limited to the 25th of every month in Nigeria.

Kodari AI
KodariOct 21 at 9:10 am 3
TaskEarnBot
A comprehensive Telegram earning bot for Nigeria with premium branding, user registration, task earning system, daily bonuses, referral rewards, secure wallet with transaction ledger, VIP membership, admin dashboard, broadcast system, and strict withdrawal windows limited to the 25th of each month in Africa/Lagos timezone. Built with Python and python-telegram-bot, using SQLite with PostgreSQL migration path. Includes automated tests for withdrawal date enforcement, duplicate prevention, and security features.
  1. Build the persistent SQLAlchemy data model and secure wallet, task, referral, bonus, withdrawal, VIP, and admin services.

  2. Add Telegram commands, inline navigation, admin workflows, notifications, and broadcast controls.

  3. Add configuration, migrations, deployment guidance, and automated tests for financial and date-sensitive rules.

  4. Keep automatic bank payouts disabled until a real provider is configured; withdrawals remain administrator-managed.

Plain Text
TaskEarn/
β”œβ”€β”€ main.py
β”œβ”€β”€ taskearn/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ database.py
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ services.py
β”‚   └── handlers.py
β”œβ”€β”€ migrations/
β”‚   β”œβ”€β”€ env.py
β”‚   └── versions/
β”‚       └── 0001_initial.py
β”œβ”€β”€ tests/
β”‚   └── test_services.py
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
β”œβ”€β”€ alembic.ini
β”œβ”€β”€ requirements.txt
└── README.md

Implemented the TaskEarn Telegram bot project with persistent SQLAlchemy storage, task and referral rewards, daily bonuses, auditable wallets, administrator workflows, VIP records, broadcasts, and withdrawals enforced on the 25th in Africa/Lagos time.

Plain Text
TaskEarn/
β”œβ”€β”€ main.py
β”œβ”€β”€ taskearn/
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ database.py
β”‚   β”œβ”€β”€ handlers.py
β”‚   β”œβ”€β”€ models.py
β”‚   └── services.py
β”œβ”€β”€ migrations/
β”‚   β”œβ”€β”€ env.py
β”‚   β”œβ”€β”€ script.py.mako
β”‚   └── versions/0001_initial.py
β”œβ”€β”€ tests/test_services.py
β”œβ”€β”€ .env.example
β”œβ”€β”€ alembic.ini
β”œβ”€β”€ requirements.txt
└── README.md

Configure BOT_TOKEN and numeric ADMIN_IDS privately in the environment. Install dependencies with python -m pip install -r requirements.txt; initialize SQLite with the command in the README, or run alembic upgrade head for PostgreSQL; then start with python main.py. The README also documents settings, backups, migrations, and persistent hosting.

Automatic bank payouts are not configured. Funds are reserved for eligible requests, and an administrator must verify the real transfer before recording a payment reference and marking a withdrawal Paid. VIP activation is also manual after payment verification.

Automated tests are included, covering registration, rewards, concurrency, authorization, broadcasts, and withdrawal-date rules. I attempted to run them, but the available Python launcher reported python3: unknown option: -m; the tests were not run, so I cannot report pass/fail results.

ROYAL CITY ROLEPLAY

Example of how the bot should looks like this and example make my own feel better

Kodari AI
KodariOct 21 at 9:19 am 1

I’ll map the bot’s current menu and message flow, then update its main screen to feel more polished and organized like the example while keeping your bot’s own features.Plan:

  1. Refresh the home message into a clear, branded dashboard-style welcome.

  2. Reorganize the existing buttons into a simpler layout without changing what they do.

  3. Keep all current earning, wallet, referral, and help features accessible.

Updated the TaskEarn home screen with a cleaner dashboard showing the user’s available balance and referral progress, plus a reorganized shortcut menu for the existing features.

ROYAL CITY ROLEPLAY

PROJECT: TASKEARN PRO β€” COMPLETE PREMIUM EARNING PLATFORM

Build a complete, production-oriented Telegram earning platform called TaskEarn Pro for the existing bot @TaskEarnNG25_Bot.

I want EVERYTHING premium, not just a beautiful welcome message.

The project must include a professional Telegram bot AND, where supported, a custom Telegram Mini App.

TECHNOLOGY:

  • Python
  • python-telegram-bot
  • FastAPI for the Mini App backend
  • PostgreSQL for production
  • SQLite for local development if appropriate
  • Responsive HTML, CSS, and JavaScript frontend
  • Secure Telegram Mini App authentication
  • Africa/Lagos timezone
  • Nigerian naira as the currency

PREMIUM USER EXPERIENCE:

  • Original TaskEarn branding and graphics.
  • Professional welcome screen and dashboard.
  • Attractive Telegram menus and inline keyboards.
  • Responsive Mini App with dashboard cards and charts.
  • User profiles and account statistics.
  • Available balance, reserved balance, pending rewards,

lifetime earnings, and paid withdrawals.

  • Task categories, task progress, and submission tracking.
  • Referral network dashboard and unique invite links.
  • Referral leaderboard and achievement badges.
  • Daily rewards and streak tracking.
  • VIP membership page with configurable benefits.
  • Notifications, transaction history, and support.
  • Accessible design suitable for Android phones.

REAL EARNING FEATURES:

  • Admin-created tasks and configurable rewards.
  • Task submissions and verification.
  • Secure reward crediting after approval.
  • Daily bonuses with server-side cooldowns.
  • Referral tracking and eligibility requirements.
  • Duplicate-reward prevention.
  • Fraud monitoring and administrator review.
  • Accurate database-backed wallets and transaction ledgers.
  • Leaderboards based on verified activity.
  • No fake balances, fake users, or fabricated earnings.

VIP MEMBERSHIP:

  • Configurable membership tiers and pricing.
  • Membership status and expiry.
  • Benefits and exclusive tasks controlled by the admin.
  • Verified payment before activating paid memberships.
  • No fabricated payment confirmations or guaranteed-profit claims.

WITHDRAWALS:

  • Requests allowed ONLY on the 25th of each calendar month.
  • Use Africa/Lagos timezone.
  • Enforce the rule on the backend for every request.
  • Reject requests on the 24th, 26th, and every other day.
  • Configurable minimum withdrawal amount.
  • Validate available balance and account eligibility.
  • Reserve funds atomically.
  • Support Pending, Approved, Rejected, and Paid statuses.
  • Restore reserved funds on rejection exactly once.
  • Require verified payment before marking a request Paid.
  • Notify users of status changes.
  • Show the next withdrawal date when the window is closed.
  • Maintain a complete audit trail.

ADMIN PANEL:

  • Restrict all administrator functions to configured Telegram IDs.
  • Manage users, tasks, rewards, referrals, and VIP memberships.
  • Review task submissions.
  • Approve or reject withdrawal requests.
  • Record confirmed payment references.
  • Broadcast announcements with delivery reporting.
  • View transaction history, statistics, and payment liabilities.
  • Configure reward settings and withdrawal limits.
  • Export reports where practical.
  • Log all sensitive administrator actions.

TELEGRAM MINI APP:

  • Authenticate users using Telegram's official Mini App

initialization data and validate it on the server.

  • Never trust user IDs supplied by the frontend alone.
  • Display real server-side balances and task information.
  • Use secure API endpoints with authorization checks.
  • Provide dashboard, tasks, referrals, wallet, VIP, withdrawals,

history, and profile pages.

  • Use a responsive layout suitable for mobile devices.
  • Do not expose bot tokens, payment credentials, or secrets

to frontend JavaScript.

  • Provide instructions for hosting the frontend over HTTPS

and configuring its URL with Telegram.

PAYMENTS:

  • Begin with a secure administrator-managed payout workflow.
  • Clearly identify any external payment-provider integration

that requires credentials.

  • Do not claim automatic transfers work unless a supported

payment provider has actually been integrated and tested.

  • Prevent duplicate payments and verify payment callbacks.
  • Never collect banking PINs, OTPs, or banking passwords.

SECURITY:

  • Environment variables for all secrets.
  • No hardcoded bot tokens.
  • Persistent database and database transactions.
  • Input validation and parameterized queries.
  • Protection against duplicate callbacks and race conditions.
  • Server-side admin permissions.
  • Secure Mini App authentication.
  • Rate limiting and structured logging.
  • Database backups and recovery instructions.
  • Audit logs for financial actions.

DELIVERABLES:

  • Complete runnable source code.
  • Telegram bot implementation.
  • Mini App frontend and backend.
  • Database schema and migrations.
  • requirements.txt and package files where needed.
  • .env.example containing placeholders only.
  • README with setup and deployment instructions.
  • Automated tests for all important financial workflows.
  • Tests for withdrawal dates, timezone handling, wallet integrity,

referral eligibility, duplicate rewards, VIP payment verification, admin permissions, and Mini App authentication.

  • Instructions for persistent hosting and HTTPS.
  • A clear list of features that need external services.

Do not provide pseudocode or fake implementations.

Do not claim tests passed unless they were actually executed.

If the project is too large to generate at once, create it in clearly identified stages without omitting essential components.

The final goal is a complete, professional TaskEarn Pro platform: premium design, genuine earning features, a responsive Mini App, a secure admin system, and reliable financial recordkeeping.

Kodari AI
KodariOct 21 at 10:11 am 8
  1. Stage 1 β€” Core foundation: inspect the existing bot, then add persistent data and safe financial primitives.

  2. Stage 2 β€” Earning workflows: tasks, verified submissions, referrals, daily rewards, VIP, and admin review.

  3. Stage 3 β€” Mini App: Telegram-authenticated FastAPI API and responsive dashboard.

  4. Stage 4 β€” Operations: financial/security tests, configuration, deployment, backup, and recovery documentation.

I’ll begin with Stage 1 and preserve the existing bot’s working behavior.

The existing bot already has a persistent wallet, reviewed tasks, referrals, admin workflows, and backend enforcement of the Lagos-time withdrawal date. Stage 1 fills a major missing piece: a Telegram-authenticated Mini App API and dashboard, while removing the token-shaped value from the sample environment file.

Implemented the TaskEarn Pro backend and Mini App on top of the existing Telegram bot.

  • Added a responsive Telegram Mini App with authenticated dashboard, tasks and submissions, wallet, withdrawals, referrals, leaderboards, VIP, history, profile, and support link.

  • Added server-side Telegram initData signature and expiry validation. API identity comes from verified Telegram dataβ€”not a frontend-supplied user IDβ€”and API requests are rate-limited.

  • Added persistent Lagos-time daily streaks, achievement badges, task and referral leaderboards, and VIP-only task access enforced for both listing and submission.

  • Added configurable VIP tiers and benefits, pending purchase records, admin review commands, payment-reference uniqueness, audit logging, and complimentary grants kept separate from paid memberships.

  • Added Alembic migrations, environment placeholders, Mini App setup instructions, and financial/authentication tests.

Paid VIP activation and withdrawals remain administrator-verified; no automatic payment or bank-transfer provider is integrated. Set the private environment values, run main.py and web.py, and configure the Mini App’s public HTTPS /app URL with Telegram. For Kodari-hosted public API hosting, deploy the backend as a Discord bot project on Kodari; hosted bots can serve an HTTPS API at https://<name>.kodaribots.com.

Tests were added but not run here: pytest is unavailable, and this environment’s Python runner does not support -m. The token-shaped value formerly in .env.example was removed; if it was a real bot token, revoke and replace it in BotFather.

ROYAL CITY ROLEPLAY

I need you to troubleshoot and FIX my existing Telegram bot project, TaskEarn.

Bot name: TaskEarn Telegram username: @TaskEarnNG25_Bot

IMPORTANT:

I have already created my Telegram bot using BotFather and inserted its bot token into my project. However, when I open my bot on Telegram and send /start, it does not respond.

I am a beginner using an Android phone. Please do the technical work for me and explain the steps in simple language.

YOUR TASK:

  1. Inspect my entire existing project and identify why the

Telegram bot is not responding.

  1. Check whether the Telegram bot token is being read correctly

from the environment or secret configuration.

  1. Check whether the required Python packages are installed

and whether the application starts successfully.

  1. Check whether the /start command is implemented correctly.
  1. Check the Telegram polling or webhook configuration.

Ensure the bot uses one valid update method and is not affected by conflicting polling processes or webhook settings.

  1. Check for errors in the startup logs and fix them.
  1. Make sure the bot responds to /start with a welcome message

and displays its main menu.

  1. Make sure the main menu buttons have working handlers.

Do not create buttons that do nothing.

  1. Preserve my existing TaskEarn features, including:

- Premium interface - Earning tasks - Wallet - Referral system - Daily bonus - VIP membership - Transaction history - Administrator dashboard - Broadcast announcements - Withdrawals ONLY on the 25th of each month using the Africa/Lagos timezone.

  1. Check that the database is initialized and that user data

persists after the application restarts.

  1. Check that the bot token is not hardcoded into public code

and is not printed in logs.

  1. If the token is invalid or missing, explain how I can

configure it securely without asking me to post it publicly.

  1. Determine whether this platform can actually run and host

a persistent Telegram bot. If it cannot, tell me exactly what external hosting or deployment service is needed.

  1. If you provide a Run, Publish, or Deploy feature, explain

how I can use it. Do not invent buttons that do not exist.

  1. Run the application and tests if your environment supports

them. Fix all errors you can reproduce.

  1. If a feature is incomplete, implement it where possible

instead of merely describing what should be done.

  1. Do not claim the bot is fixed unless you have verified that

the application starts successfully and the /start handler works.

FIRST RESPONSE:

Tell me what is preventing my bot from responding, what you found in the project, and what you changed.

THEN:

Fix the project, list the remaining steps, and guide me through getting TaskEarn online using simple instructions suitable for an Android phone.

Kodari AI
KodariOct 21 at 1:09 pm 1
  1. Trace TaskEarn’s startup, token configuration, Telegram update handling, menu callbacks, and database setup.

  2. Fix the confirmed causes while preserving existing features.

  3. Validate what this environment can run, then give you simple Android steps to get it online.

What is preventing /start from responding

In the workspace I checked, BOT_TOKEN is missing: there is no .env file and the runtime environment does not contain that variable. main.py checks for it and exits before it starts Telegram polling, so it cannot receive /start. I can’t tell whether the token you added elsewhere is valid because it isn’t available in this runtime. Don’t post it here.

What I found and changed

  • /start is implemented and registered. It registers the user and displays the home menu.

  • The menu buttons route to handlers for tasks, wallet, referrals, daily bonus, withdrawals, history, VIP, announcements and help. Administrator actions are also routed.

  • The bot is configured for polling, not a webhook. I can’t tell whether another copy is polling with the same token; run only one bot process.

  • The database initializes before polling. The default SQLite database persists only if its storage persists; production should use PostgreSQL on durable storage.

  • Withdrawal requests are checked against the 25th in the Africa/Lagos timezone.

  • The token is read from the environment or a private .env; I found no hardcoded token or direct token logging in the startup code.

  • I made no code changes. I found no handler defect to patch, and I can’t supply or test your private token. Claiming the bot is fixed without a successful startup and Telegram check would be misleading.

The requirements are listed in requirements.txt, but I could not verify the installed packages or a working startup. python -m pytest -q exited with status 2, and this environment provided no diagnostic output. I therefore cannot confirm that the tests pass or that /start works end to end.

Steps to get TaskEarn online from Android

  1. Configure the token privately. In the deployment environment’s secret or environment-variable settings, set BOT_TOKEN to the token from BotFather. Do not put it in a public source file or send it in chat. Also configure ADMIN_IDS with your numeric Telegram user ID.

  2. Use a persistent Python worker. This project needs a process that stays running with the start command python main.py; one that sleeps or stops after a short request will not work. Run only one polling worker. If you use the Mini App/API too, it also needs to run as a separate process with the same durable database configuration.

  3. Use durable database storage. The default sqlite:///taskearn.db is suitable only when the host preserves that file across restarts. Use PostgreSQL for production.

  4. Test after deployment. Check the worker’s startup logs for errors, then open @TaskEarnNG25_Bot in Telegram and send /start. If the token is missing, startup will stop; if it is invalid, Telegram will reject the bot connection.

Hosting limitation: I can’t point you to a Run, Publish, or Deploy button in this project. Kodari’s 24/7 hosting is for Discord bot projects; a Discord project can serve an HTTP API, but that does not by itself run this Telegram polling worker. This TaskEarn code needs a persistent Python-worker deployment target with private secrets and durable storage.

Kodari can make mistakes. Review important code before using.
Files
migrations
taskearn
tests
.gitignore
alembic.ini
main.py
README.md
requirements.txt
web.py
Code
23 3,271
main.py
import logging

from telegram import BotCommand
from telegram import MenuButtonWebApp, WebAppInfo
from telegram.ext import Application

from taskearn.config import Settings
from taskearn.database import Database
from taskearn.handlers import register_handlers
from taskearn.services import TaskEarnService


async def post_init(application: Application) -> None:
    await application.bot.set_my_commands([
        BotCommand("start", "Open TaskEarn"),
        BotCommand("help", "How to use TaskEarn"),
        BotCommand("wallet", "View your wallet"),
        BotCommand("earn", "Browse earning tasks"),
        BotCommand("daily", "Claim your daily bonus"),
        BotCommand("refer", "Referral link and stats"),
        BotCommand("withdraw", "Request a withdrawal"),
        BotCommand("history", "View transactions"),
        BotCommand("admin", "Administrator dashboard"),
        BotCommand("stats", "Administrator statistics"),
        BotCommand("broadcast", "Create an announcement"),
        BotCommand("vipplan", "Configure VIP plans (admin)"),
        BotCommand("vippurchases", "Review VIP payments (admin)"),
        BotCommand("vipapprove", "Verify a VIP payment (admin)"),
        BotCommand("vipreject", "Reject a VIP payment (admin)"),
    ])
    if Settings.MINIAPP_URL.startswith("https://"):
        await application.bot.set_chat_menu_button(
            menu_button=MenuButtonWebApp(text="TaskEarn Pro", web_app=WebAppInfo(url=Settings.MINIAPP_URL))
        )


def main() -> None:
    logging.basicConfig(
        level=getattr(logging, Settings.LOG_LEVEL.upper(), logging.INFO),
        format="%(asctime)s %(levelname)s %(name)s %(message)s",
    )
    if not Settings.BOT_TOKEN:
        raise SystemExit("Configure BOT_TOKEN privately in the environment before starting TaskEarn.")

    database = Database(Settings.DATABASE_URL)
    database.initialize()
    service = TaskEarnService(database, Settings.ADMIN_IDS)
    application = Application.builder().token(Settings.BOT_TOKEN).post_init(post_init).build()
    application.bot_data["service"] = service
    application.bot_data["settings"] = Settings
    register_handlers(application)
    logging.getLogger("taskearn").info("TaskEarn starting; database initialized")
    application.run_polling(allowed_updates=["message", "callback_query"])


if __name__ == "__main__":
    main()