Skip to content

NickScherbakov/robot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Earning Robot Hero Banner

Autonomous AI-powered system for income generation through intelligent task automation

License Python Version GitHub stars GitHub forks Last Commit Code Size

Features โ€ข Quick Start โ€ข Demo โ€ข Documentation โ€ข Contributing


๐Ÿ“‹ Table of Contents


๐ŸŒŸ About

Earning Robot is an autonomous AI-powered earning system that operates through a laptop, phone, and internet connection. The robot accepts user requests, executes tasks using external AI APIs (OpenAI, Mistral), automatically handles payments via Stripe, and generates comprehensive financial reports.

โœจ Features

๐Ÿค– AI Integration

  • Multiple AI Providers: OpenAI GPT and Mistral AI support
  • Smart Routing: Automatic provider selection based on task
  • Token Tracking: Real-time usage and cost monitoring
  • Response Caching: Optimize costs with intelligent caching
  • Model Optimizer: AI cost optimization like Google Vertex AI

๐ŸŽฏ SelfEarnBot - NEW!

  • Autonomous Earning: AI content arbitrage bot
  • Smart Opportunity Detection: Finds content opportunities
  • Auto Content Generation: Creates articles, code, SEO content
  • Auto Publishing: Submits to platforms automatically
  • Self-Learning: Improves from successes and failures
  • Auto Reinvestment: Grows budget automatically

๐Ÿ’ฌ Control Interfaces

  • Telegram Bot: Full mobile control from anywhere

  • REST API: Programmatic access for integrations

  • CLI Tool: Command-line interface for advanced users

  • Owner Authentication: Secure access control

๐Ÿ’ฐ Payment & Billing

  • Stripe Integration: Professional payment processing
  • Subscription Model: Recurring monthly payments
  • Micro-payments: Pay-per-operation pricing
  • Automated Invoicing: Professional invoice generation

๐Ÿ“Š Analytics & Reporting

  • Daily Reports: Automated financial summaries

  • Weekly Analysis: Trend tracking and insights

  • Monthly Overview: Comprehensive profit/loss statements

  • Real-time Dashboard: Live task and revenue monitoring

๐Ÿ”’ Security & Privacy

  • Local Database: SQLite for complete data control

  • Environment Variables: Secure credential management

  • No Data Sharing: Everything stays on your infrastructure

  • Webhook Verification: Stripe signature validation

๐Ÿš€ Deployment

  • Laptop Ready: Run directly on any laptop

  • Docker Support: Containerized deployment option

  • VPS Compatible: Easy cloud server deployment

  • Auto-scaling: Handle varying loads efficiently

๐Ÿ—๏ธ Architecture

graph TB
    subgraph "User Interface Layer"
        A[๐Ÿ“ฑ Telegram Bot]
        B[๐ŸŒ REST API]
        C[๐Ÿ’ป CLI Tool]
    end
    
    subgraph "Processing Layer"
        D[๐Ÿค– AI Manager]
        E[๐Ÿ’ณ Payment Processor]
        F[๐Ÿ“Š Report Generator]
        G[โฐ Task Scheduler]
    end
    
    subgraph "External Services"
        H[๐Ÿง  OpenAI / Mistral]
        I[๐Ÿ’ฐ Stripe]
    end
    
    subgraph "Data Layer"
        J[(๐Ÿ—„๏ธ SQLite Database)]
    end
    
    A --> D
    B --> D
    C --> D
    
    D --> H
    D --> J
    E --> I
    E --> J
    F --> J
    G --> D
    G --> F
    
    style A fill:#667eea,stroke:#764ba2,color:#fff
    style B fill:#667eea,stroke:#764ba2,color:#fff
    style C fill:#667eea,stroke:#764ba2,color:#fff
    style D fill:#764ba2,stroke:#667eea,color:#fff
    style E fill:#764ba2,stroke:#667eea,color:#fff
    style F fill:#764ba2,stroke:#667eea,color:#fff
    style G fill:#764ba2,stroke:#667eea,color:#fff
    style H fill:#4CAF50,stroke:#2e7d32,color:#fff
    style I fill:#4CAF50,stroke:#2e7d32,color:#fff
    style J fill:#2196F3,stroke:#1565c0,color:#fff
Loading

Project Structure

robot/
โ”œโ”€โ”€ backend/              # Core backend logic
โ”‚   โ”œโ”€โ”€ app.py           # Flask REST API server
โ”‚   โ”œโ”€โ”€ config.py        # Configuration management
โ”‚   โ”œโ”€โ”€ database.py      # Database models and ORM
โ”‚   โ”œโ”€โ”€ ai_providers.py  # AI API integrations
โ”‚   โ”œโ”€โ”€ scheduler.py     # Automated task scheduler
โ”‚   โ”œโ”€โ”€ model_optimizer.py      # ๐Ÿ†• AI cost optimization engine
โ”‚   โ”œโ”€โ”€ optimizer_api.py        # ๐Ÿ†• Optimizer REST API
โ”‚   โ””โ”€โ”€ optimizer_middleware.py # ๐Ÿ†• Auto-tracking middleware
โ”œโ”€โ”€ frontend/            # User interfaces
โ”‚   โ””โ”€โ”€ telegram_bot.py  # Telegram bot interface
โ”œโ”€โ”€ billing/             # Payment and financial logic
โ”‚   โ”œโ”€โ”€ payment_processor.py  # Stripe payment integration
โ”‚   โ””โ”€โ”€ reporting.py     # Financial report generation
โ”œโ”€โ”€ selfbot/             # ๐Ÿ†• SelfEarnBot - Autonomous AI Content Arbitrage
โ”‚   โ”œโ”€โ”€ scanner/         # Opportunity detection
โ”‚   โ”œโ”€โ”€ generator/       # AI content generation
โ”‚   โ”œโ”€โ”€ publisher/       # Content publishing
โ”‚   โ”œโ”€โ”€ brain/           # Decision engine
โ”‚   โ”œโ”€โ”€ finance/         # Financial management
โ”‚   โ”œโ”€โ”€ evolution/       # Self-learning & optimization
โ”‚   โ”œโ”€โ”€ database/        # SelfBot data models
โ”‚   โ””โ”€โ”€ main.py          # SelfBot main loop
โ”œโ”€โ”€ docs/                # Documentation
โ”œโ”€โ”€ tests/               # Test files
โ”œโ”€โ”€ .env.example         # Example environment variables
โ”œโ”€โ”€ .gitignore          # Git ignore rules
โ”œโ”€โ”€ requirements.txt     # Python dependencies
โ”œโ”€โ”€ main.py             # Main entry point
โ””โ”€โ”€ README.md           # This file

๐Ÿš€ Quick Start

Prerequisites

๐Ÿ
Python 3.8+
๐Ÿ’ฌ
Telegram Account
๐Ÿ’ณ
Stripe Account
๐Ÿค–
AI API Keys

Installation

1. Clone the repository

git clone https://github.com/NickScherbakov/robot.git
cd robot

2. Install dependencies

pip install -r requirements.txt

3. Configure environment variables

cp .env.example .env
# Edit .env with your API keys and credentials

4. Set up your Telegram bot

  • Talk to @BotFather on Telegram
  • Create a new bot and get your bot token
  • Add the token to .env as TELEGRAM_BOT_TOKEN
  • Get your Telegram user ID (use @userinfobot)
  • Add your user ID to .env as TELEGRAM_OWNER_ID

5. Configure API keys

Service Link Environment Variable
OpenAI platform.openai.com OPENAI_API_KEY
Mistral AI mistral.ai MISTRAL_API_KEY
Stripe dashboard.stripe.com STRIPE_SECRET_KEY

Running the Robot

All components together:

python main.py

Or run components separately:

# Run Flask API server
python backend/app.py

# Run Telegram bot (in another terminal)
python frontend/telegram_bot.py

# Run scheduler (in another terminal)
python backend/scheduler.py

๐Ÿ’ก Tip: Use tmux or screen for running multiple components in the background on a VPS.

๐Ÿ“ธ Screenshots

๐Ÿ’ฌ Telegram Bot Interface

Telegram Bot Chat
Chat Interface
Daily Report
Financial Reports
Settings Menu
Settings & Configuration

๐ŸŒ Web Dashboard

Analytics Dashboard
Real-time Analytics Dashboard

๐Ÿ“ท Note: Screenshots shown are placeholders. See the live demo website for interactive examples.


๐Ÿ“ฑ Telegram Bot Usage

Once the bot is running, you can control it via Telegram:

Available Commands

Command Description Access Level
/start Initialize the bot and show welcome message ๐Ÿ‘ค User
/help Display help information and command list ๐Ÿ‘ค User
/ask <question> Ask AI a question and get response ๐Ÿ‘ค User
/status Check robot operational status ๐Ÿ‘ค User
/selfbot SelfEarnBot control and help ๐Ÿ‘‘ Owner
/selfbot_status Check SelfBot status and earnings ๐Ÿ‘‘ Owner
/selfbot_stats Get SelfBot performance statistics ๐Ÿ‘‘ Owner
/selfbot_report Get detailed SelfBot report ๐Ÿ‘‘ Owner
/report [daily|weekly|monthly] Get financial report (default: daily) ๐Ÿ‘‘ Owner
/settings Configure robot settings ๐Ÿ‘‘ Owner

Usage Examples

๐Ÿ’ฌ User: /ask What is the capital of France?
๐Ÿค– Robot: The capital of France is Paris, a beautiful city known for its art, culture, and history.

๐Ÿ’ฌ User: /ask Explain quantum computing in simple terms
๐Ÿค– Robot: Quantum computing is a type of computation that harnesses quantum mechanics...

๐Ÿ’ฌ User: /status
๐Ÿค– Robot: โœ… All systems operational
         ๐Ÿ“Š Tasks today: 42
         ๐Ÿ’ฐ Revenue: $21.00
         ๐Ÿ“‰ Expenses: $0.84
         ๐Ÿ’ต Profit: $20.16

๐Ÿ’ฌ Owner: /report daily
๐Ÿค– Robot: ๐Ÿ“Š Daily Financial Report
         [Detailed report follows...]

๐Ÿ’ก Pro Tip: You can send regular messages without commands - they will be treated as AI questions automatically!


๐Ÿค– SelfEarnBot - Autonomous AI Content Arbitrage

Overview

SelfEarnBot is an autonomous AI-powered content arbitrage bot that operates 24/7 to find opportunities, generate content, and earn money automatically.

How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  1. SCAN โ†’ 2. EVALUATE โ†’ 3. GENERATE       โ”‚
โ”‚  โ†“                                           โ”‚
โ”‚  7. REINVEST โ† 6. LEARN โ† 5. TRACK โ† 4. PUBLISH โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Scan: Finds content opportunities from RSS feeds, freelance platforms, content marketplaces
  2. Evaluate: AI "brain" scores opportunities by profitability and feasibility
  3. Generate: Creates content using AI (articles, code, SEO) for $0.01-$0.20
  4. Publish: Submits to platforms (Medium, Dev.to, freelance sites)
  5. Track: Records revenue, costs, ROI
  6. Learn: Improves from successes and failures
  7. Reinvest: Auto-reinvests profits to grow the operation

Economics

Content Type Revenue AI Cost Margin
Article $5-$50 $0.01-$0.10 ~95%
Code $10-$100 $0.02-$0.20 ~95%
SEO Content $3-$30 $0.01-$0.08 ~95%

Quick Start

# Configure in .env
SELFBOT_INITIAL_BUDGET=10.00
SELFBOT_AUTO_REINVEST=true
SELFBOT_REINVEST_PERCENTAGE=50

# Run SelfBot
python selfbot/main.py

# Or control via Telegram
/selfbot_status
/selfbot_stats
/selfbot_report

Features

  • โœ… Fully Autonomous: Operates without human intervention
  • ๐Ÿง  Smart Decision Making: AI-powered opportunity scoring
  • ๐Ÿ’ฐ Auto Reinvestment: Grows budget automatically
  • ๐Ÿ“Š Self-Learning: Improves strategies from experience
  • ๐Ÿ“ˆ High ROI: 95%+ profit margins
  • ๐Ÿ”’ Safe Demo Mode: Test without real publishing

Results (Expected)

Week 1 (Conservative):

  • Initial budget: $10
  • Operations/day: ~10
  • Avg profit/op: $5
  • Week profit: ~$350

Month 1 (With reinvestment):

  • Budget grows to: ~$200
  • Operations/day: ~50
  • Month profit: ~$7,500

Results depend on market conditions and configuration

Documentation

๐Ÿ“š Full documentation: selfbot/README.md

๐Ÿ’ก Pro Tip: You can send regular messages without commands - they will be treated as AI questions automatically!

๐ŸŒ REST API

The Flask server provides a comprehensive REST API on http://localhost:5000

API Endpoints

๐Ÿ“Š Health & Status

Health Check

GET /health

Response:

{
  "status": "healthy",
  "uptime": "2 days, 3 hours"
}

Get Statistics

GET /api/stats

Response:

{
  "tasks_today": 42,
  "tasks_total": 1337,
  "revenue": 21.00,
  "expenses": 0.84,
  "profit": 20.16
}
๐Ÿค– AI Task Management

Execute AI Task

POST /api/task
Content-Type: application/json

Request:

{
  "prompt": "Your question here",
  "provider": "openai",
  "user_id": "user@example.com"
}

Response:

{
  "task_id": "task_abc123",
  "response": "AI generated response...",
  "tokens_used": 150,
  "cost": 0.002,
  "provider": "openai"
}

Get Task Status

GET /api/task/{task_id}

List Tasks

GET /api/tasks?status=completed&limit=10
๐Ÿ’ฐ Payment Management

Create Subscription

POST /api/payment/subscription
Content-Type: application/json

Request:

{
  "email": "customer@example.com",
  "plan": "monthly"
}

Response:

{
  "checkout_url": "https://checkout.stripe.com/...",
  "subscription_id": "sub_abc123"
}
๐Ÿ“Š Financial Reports

Get Financial Report

GET /api/report/{period}

Periods: daily, weekly, monthly

Response:

{
  "period": "daily",
  "date": "2024-12-17",
  "revenue": 21.00,
  "expenses": 0.84,
  "profit": 20.16,
  "tasks": 42,
  "breakdown": {
    "subscriptions": 15.00,
    "micro_payments": 6.00,
    "api_costs": 0.84
  }
}

Usage Examples

๐Ÿš cURL Examples
# Ask AI a question
curl -X POST http://localhost:5000/api/task \
  -H "Content-Type: application/json" \
  -d '{"prompt": "What is AI?", "provider": "openai"}'

# Get daily report
curl http://localhost:5000/api/report/daily

# Check statistics
curl http://localhost:5000/api/stats
๐Ÿ Python Examples
import requests

# Execute AI task
response = requests.post('http://localhost:5000/api/task', json={
    'prompt': 'Explain machine learning',
    'provider': 'openai'
})
result = response.json()
print(result['response'])

# Get report
report = requests.get('http://localhost:5000/api/report/daily').json()
print(f"Profit: ${report['profit']:.2f}")

# Subscribe a customer
subscription = requests.post('http://localhost:5000/api/payment/subscription', json={
    'email': 'customer@example.com'
})
print(f"Checkout URL: {subscription.json()['checkout_url']}")
๐Ÿ“œ JavaScript Examples
// Execute AI task
const response = await fetch('http://localhost:5000/api/task', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    prompt: 'What is blockchain?',
    provider: 'mistral'
  })
});
const result = await response.json();
console.log(result.response);

// Get statistics
const stats = await fetch('http://localhost:5000/api/stats').then(r => r.json());
console.log(`Tasks today: ${stats.tasks_today}`);

๐Ÿ’ฐ Payment Configuration

Payment Models

๐Ÿ”„ Monthly Subscription ๐Ÿ’ต Micro-payments
  • Recurring monthly billing
  • Unlimited tasks included
  • Default: $29.99/month
  • Configured via SUBSCRIPTION_MONTHLY_PRICE
  • Automatic renewal
  • Managed through Stripe
  • Pay per task/operation
  • No commitment required
  • Default: $0.50/operation
  • Configured via MICRO_PAYMENT_PRICE
  • Instant charging
  • Ideal for occasional users

Stripe Setup Guide

Step 1: Create Stripe Account

  1. Sign up at stripe.com
  2. Complete account verification
  3. Navigate to Dashboard โ†’ Developers

Step 2: Get API Keys

# Add to .env file
STRIPE_SECRET_KEY=sk_test_... # or sk_live_...
STRIPE_PUBLISHABLE_KEY=pk_test_... # or pk_live_...

Step 3: Configure Webhooks (for production)

  1. Go to Dashboard โ†’ Developers โ†’ Webhooks
  2. Add endpoint: https://yourdomain.com/api/webhook/stripe
  3. Select events:
    • โœ… checkout.session.completed
    • โœ… invoice.paid
    • โœ… invoice.payment_failed
    • โœ… customer.subscription.deleted
  4. Copy webhook signing secret:
    STRIPE_WEBHOOK_SECRET=whsec_...

Pricing Configuration

Edit your .env file:

# Monthly subscription price in USD
SUBSCRIPTION_MONTHLY_PRICE=29.99

# Per-operation price in USD
MICRO_PAYMENT_PRICE=0.50

# Stripe API keys
STRIPE_SECRET_KEY=your_secret_key
STRIPE_PUBLISHABLE_KEY=your_publishable_key
STRIPE_WEBHOOK_SECRET=your_webhook_secret

๐Ÿ“Š Financial Reporting

Automated Reports

The robot automatically generates and sends comprehensive financial reports via Telegram:

Report Type Schedule Contents
๐Ÿ“… Daily Report Every day at 09:00 UTC
(configurable)
โ€ข Total income & expenses
โ€ข Net profit/loss
โ€ข Task count & completion rate
โ€ข Top performing hours
โ€ข Cost per task breakdown
๐Ÿ“† Weekly Report Every Monday at 09:00 UTC โ€ข 7-day summary
โ€ข Week-over-week comparison
โ€ข Trend analysis
โ€ข Revenue growth percentage
โ€ข Average daily profit
๐Ÿ“Š Monthly Report On-demand via /report monthly โ€ข Complete month overview
โ€ข Category-wise breakdown
โ€ข Profitability metrics
โ€ข Customer analytics
โ€ข Expense optimization suggestions

Report Example

๐Ÿ“Š Daily Financial Report - Dec 17, 2025
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐Ÿ“ˆ REVENUE
โ”œโ”€ Subscriptions:      $15.00 (3 active)
โ”œโ”€ Micro-payments:      $6.00 (12 tasks)
โ””โ”€ Total Revenue:      $21.00

๐Ÿ“‰ EXPENSES
โ”œโ”€ OpenAI API:          $0.52 (26 tasks)
โ”œโ”€ Mistral API:         $0.32 (16 tasks)
โ””โ”€ Total Expenses:      $0.84

๐Ÿ’ฐ NET PROFIT:         $20.16
๐Ÿ“Š Profit Margin:      96.0%

๐ŸŽฏ PERFORMANCE
โ”œโ”€ Tasks Completed:     42
โ”œโ”€ Success Rate:       100%
โ”œโ”€ Avg Response Time:   2.3s
โ””โ”€ Customer Satisfaction: โญโญโญโญโญ

๐Ÿ“Œ TOP INSIGHTS
โ€ข Peak hour: 14:00-15:00 (8 tasks)
โ€ข Most used provider: OpenAI (62%)
โ€ข Average revenue per task: $0.50

Manual Report Commands

Request reports anytime via Telegram:

/report daily    # Get today's report
/report weekly   # Get this week's report
/report monthly  # Get this month's report

Export Options

Reports can be exported in multiple formats:

  • ๐Ÿ“ฑ Telegram Message (default)
  • ๐Ÿ“ง Email (configure SMTP settings)
  • ๐Ÿ“„ PDF (generated on-demand)
  • ๐Ÿ“Š CSV (for spreadsheet analysis)
  • ๐Ÿ”— Google Sheets (auto-sync option)

๐Ÿ”ง Configuration

All configuration is managed through environment variables in .env:

Required Settings

# Telegram Bot (REQUIRED)
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
TELEGRAM_OWNER_ID=123456789

AI Provider Settings

# OpenAI (Optional but recommended)
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini  # or gpt-4o

# Mistral AI (Optional)
MISTRAL_API_KEY=...
MISTRAL_MODEL=mistral-small  # or mistral-medium

Payment Gateway

# Stripe (Optional - required for payments)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

Application Settings

# Database
DATABASE_PATH=data/robot.db

# Security
SECRET_KEY=your-random-secret-key-here

# Pricing
SUBSCRIPTION_MONTHLY_PRICE=29.99
MICRO_PAYMENT_PRICE=0.50

# Reporting
REPORT_TIME=09:00
TIMEZONE=UTC

# Server
HOST=0.0.0.0
PORT=5000
DEBUG=False

Advanced Options

# Rate Limiting
MAX_REQUESTS_PER_HOUR=100
MAX_TOKENS_PER_REQUEST=2000

# Caching
ENABLE_CACHE=True
CACHE_TTL=3600

# Logging
LOG_LEVEL=INFO
LOG_FILE=logs/robot.log

# Email Notifications (Optional)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
NOTIFICATION_EMAIL=owner@example.com

๐Ÿ“ˆ Monitoring & Logs

System Status

Check system status:

  • Via Telegram: /status
  • Via API: GET /api/stats

Health Checks

The scheduler automatically checks system health every hour and sends alerts if:

  • More than 5 tasks fail within an hour
  • System resources are low
  • API errors increase

Logging

All components log to console. To save logs to file:

python main.py >> logs/robot.log 2>&1

๐Ÿงช Testing

Running Tests

# Run all tests
pytest tests/

# Run with coverage
pytest --cov=backend --cov=frontend --cov=billing tests/

# Run specific test file
pytest tests/test_ai_providers.py

# Run with verbose output
pytest -v tests/

Test Structure

tests/
โ”œโ”€โ”€ test_ai_providers.py      # AI integration tests
โ”œโ”€โ”€ test_payment_processor.py # Payment system tests
โ”œโ”€โ”€ test_telegram_bot.py      # Bot functionality tests
โ”œโ”€โ”€ test_api.py               # REST API tests
โ””โ”€โ”€ test_reporting.py         # Report generation tests

Writing Tests

import pytest
from backend.ai_providers import OpenAIProvider

def test_ai_provider():
    provider = OpenAIProvider()
    response = provider.generate_response("Hello")
    assert response['response'] is not None
    assert response['tokens_used'] > 0

๐Ÿ”’ Security

Security Features

Feature Implementation Status
๐Ÿ” API Key Protection Environment variables, never in code โœ… Implemented
๐Ÿ‘ค Owner Authentication Telegram ID verification โœ… Implemented
๐Ÿ” Webhook Verification Stripe signature validation โœ… Implemented
๐Ÿ’‰ SQL Injection Protection SQLAlchemy ORM โœ… Implemented
๐Ÿ”„ Rate Limiting Per-user request throttling โœ… Implemented
๐Ÿ“ Audit Logging All operations logged โœ… Implemented

Security Best Practices

โœ… DO:

  • Store .env file securely, never commit it
  • Use strong SECRET_KEY (generate with python -c "import secrets; print(secrets.token_hex(32))")
  • Enable HTTPS in production
  • Regularly rotate API keys
  • Monitor logs for suspicious activity
  • Use Stripe's test mode for development
  • Keep dependencies updated (pip install --upgrade -r requirements.txt)

โŒ DON'T:

  • Commit .env or any credentials to git
  • Use the same API keys for dev and production
  • Expose admin endpoints without authentication
  • Ignore security warnings from dependencies
  • Run as root user in production

Vulnerability Reporting

Found a security issue? Please report it privately to:

Do not create public issues for security vulnerabilities.

๐Ÿš€ Deployment

๐Ÿ’ป Local Deployment (Laptop/Desktop)

Simple one-command start:

python main.py

The robot will run on your laptop. Keep the terminal open or use a process manager.

Run in background (Linux/Mac):

nohup python main.py > logs/robot.log 2>&1 &

Using screen/tmux:

# Using screen
screen -S earning-robot
python main.py
# Press Ctrl+A, D to detach

# Using tmux
tmux new -s earning-robot
python main.py
# Press Ctrl+B, D to detach

๐Ÿณ Docker Deployment

Build and run with Docker:

# Build the image
docker build -t earning-robot .

# Run the container
docker run -d \
  --name earning-robot \
  --env-file .env \
  -p 5000:5000 \
  -v $(pwd)/data:/app/data \
  earning-robot

Using Docker Compose:

docker-compose up -d

โ˜๏ธ Cloud Deployment

Heroku
# Create Procfile
echo "web: python main.py" > Procfile

# Deploy
heroku create your-robot-name
heroku config:set TELEGRAM_BOT_TOKEN=your_token
heroku config:set TELEGRAM_OWNER_ID=your_id
heroku config:set OPENAI_API_KEY=your_key
# ... set other config vars
git push heroku main
VPS (Ubuntu/Debian)
# Install Python 3.8+
sudo apt update
sudo apt install python3 python3-pip git

# Clone and setup
git clone https://github.com/NickScherbakov/robot.git
cd robot
pip3 install -r requirements.txt

# Configure environment
cp .env.example .env
nano .env  # Edit with your credentials

# Run as systemd service (see below)
AWS EC2
  1. Launch EC2 instance (Ubuntu 22.04 LTS)
  2. Configure security group (allow port 5000)
  3. SSH into instance
  4. Follow VPS deployment steps above
  5. Configure Elastic IP for static address
  6. Set up CloudWatch for monitoring
Google Cloud Run
# Build and deploy
gcloud builds submit --tag gcr.io/PROJECT_ID/earning-robot
gcloud run deploy earning-robot \
  --image gcr.io/PROJECT_ID/earning-robot \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated

๐Ÿ”„ Running as a System Service (Linux)

Create /etc/systemd/system/earning-robot.service:

[Unit]
Description=Earning Robot - Autonomous AI Income System
After=network.target

[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser/robot
Environment="PATH=/home/youruser/.local/bin:/usr/bin"
ExecStart=/usr/bin/python3 /home/youruser/robot/main.py
Restart=always
RestartSec=10
StandardOutput=append:/home/youruser/robot/logs/robot.log
StandardError=append:/home/youruser/robot/logs/error.log

[Install]
WantedBy=multi-user.target

Enable and start the service:

# Reload systemd
sudo systemctl daemon-reload

# Enable on boot
sudo systemctl enable earning-robot

# Start the service
sudo systemctl start earning-robot

# Check status
sudo systemctl status earning-robot

# View logs
sudo journalctl -u earning-robot -f

๐Ÿ“Š Monitoring & Health Checks

Setup monitoring:

# Install monitoring tools
pip install prometheus-client

# Health check endpoint
curl http://localhost:5000/health

# Monitor with cron
crontab -e
# Add: */5 * * * * curl -f http://localhost:5000/health || systemctl restart earning-robot

๐Ÿ“š Documentation

Available Documentation

Document Description Link
๐Ÿ“– API Documentation Complete REST API reference API_DOCUMENTATION.md
๐Ÿ”ง Installation Guide Detailed setup instructions INSTALLATION.md
๐Ÿณ Docker Guide Containerization and deployment DOCKER.md
๐Ÿ’ก Examples Code examples and use cases EXAMPLES.md
โ“ FAQ Frequently asked questions FAQ.md
๐Ÿ—๏ธ Architecture System design and structure ARCHITECTURE.md
๐Ÿš€ Quick Start Get started in 5 minutes QUICKSTART.md

Additional Resources


๐Ÿค Contributing

We love contributions! The Earning Robot is open source and welcomes improvements from the community.

How to Contribute

Bug Reports
Bug Reports
Found a bug?
Let us know!

Report Bug
Feature Requests
Feature Requests
Have an idea?
Share it!

Request Feature
Documentation
Documentation
Improve docs
Help others!

Contribute Docs
Code
Code
Submit PRs
Build features!

Contribute Code

Quick Contribution Guide

  1. Fork the repository

    # Click the Fork button on GitHub, then:
    git clone https://github.com/YOUR_USERNAME/robot.git
    cd robot
  2. Create a feature branch

    git checkout -b feature/amazing-feature
  3. Make your changes

    # Edit files, add tests
    pytest tests/
  4. Commit your changes

    git add .
    git commit -m "Add amazing feature"
  5. Push and create PR

    git push origin feature/amazing-feature
    # Then open a Pull Request on GitHub

Development Setup

# Install development dependencies
pip install -r requirements-dev.txt

# Install pre-commit hooks
pre-commit install

# Run linters
black .
flake8 .
mypy backend/ frontend/ billing/

# Run tests
pytest --cov

Contribution Guidelines

  • ๐Ÿ“ Follow PEP 8 style guide for Python code
  • โœ… Write tests for new features
  • ๐Ÿ“– Update documentation for changes
  • ๐Ÿ”’ Never commit sensitive data or API keys
  • ๐Ÿ’ฌ Use clear, descriptive commit messages
  • ๐ŸŽฏ Keep PRs focused on a single feature/fix

Contributors

Made with contrib.rocks


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

License: MIT

TL;DR: You can use, modify, and distribute this software freely, even for commercial purposes.


๐ŸŒ Live Demo Website

Visit our interactive demonstration website to learn more about the Earning Robot:

๐ŸŽฏ
Interactive Demo
Try the bot simulation
๐Ÿ“Š
Live Analytics
See real-time metrics
๐Ÿ—๏ธ
Architecture
Visual system design
๐Ÿ“š
Documentation
Complete guides

The website features:

  • โœจ Modern, responsive design with dark mode support
  • ๐ŸŽฎ Interactive demo panel with simulated AI interactions
  • ๐Ÿ“Š Real-time financial flow visualization
  • ๐Ÿš€ Quick start guides and comprehensive documentation
  • ๐Ÿ“ฑ Mobile-optimized interface

๐ŸŽฏ Roadmap

See our development roadmap

Version 2.0 (Planned)

  • Add support for Claude AI and Google Gemini
  • Web-based dashboard UI with React
  • Multi-user support with role-based access
  • Advanced analytics and business intelligence
  • Webhook support for external integrations
  • Plugin system for custom extensions

Version 2.5 (Future)

  • Multi-language support (i18n)
  • Mobile apps (iOS/Android)
  • Voice interface integration
  • Advanced ML-based cost optimization
  • Marketplace for custom plugins
  • White-label solution for businesses

Version 3.0 (Vision)

  • Distributed deployment across multiple regions
  • Auto-scaling based on demand
  • Advanced fraud detection
  • Blockchain-based transaction logging
  • AI-powered financial forecasting
  • Enterprise features (SSO, audit logs, compliance)

Want to contribute to the roadmap? Open a feature request!


๐Ÿ’ฌ Community & Support

Get Help & Stay Connected

Issues
Issues
Discussions
Discussions
Pull Requests
Pull Requests

Support Options


๐Ÿ™ Acknowledgments

  • OpenAI for GPT API
  • Mistral AI for Mistral API
  • Stripe for payment processing
  • Python Telegram Bot for Telegram integration
  • Flask for web framework
  • All our amazing contributors!

โญ Star History

Star History Chart


Built with โค๏ธ for Autonomous Earning

If you found this project helpful, please consider:

Star on GitHub Fork on GitHub Watch on GitHub

Share the project:

Twitter LinkedIn Reddit


ยฉ 2025 Earning Robot | MIT License | Code of Conduct | Contributing Guidelines

Made with ๐Ÿค– and โ˜•

About

Autonomous earning robot powered by AI orchestration and privacy-first financial

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors