littleshop/TeleBot
SysAdmin 1e93008df4 Fix: Variant selection now accumulates across types instead of resetting
Problem:
- Selecting Size then Color would reset Size selection
- Users could never get "Add to Cart" button with multiple variant types
- Each selection created a NEW list, wiping previous choices

Root Cause:
- HandleSetVariant created: new List<string> { variantName }
- This replaced all previous selections instead of accumulating

Fix:
1. Get existing selected variants from session
2. Find the variant type of newly selected variant
3. Remove any previous selection from the SAME type (allow changing choice)
4. Add the new selection
5. Save accumulated list back to session

Example behavior now:
- Select "Red" (Color) → selectedVariants = ["Red"]
- Select "Large" (Size) → selectedVariants = ["Red", "Large"] 
- Select "Blue" (Color) → selectedVariants = ["Blue", "Large"] 
- Can now confirm when all types selected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 02:44:28 +01:00
..
.claude "Add-Multi-Buy-section-to-product-editor" 2025-10-03 14:41:00 +01:00
BotManagerTestClient Add customer communication system 2025-08-27 18:02:39 +01:00
Scripts CI/CD: Add GitLab CI/CD pipeline for Hostinger deployment 2025-10-01 13:10:48 +01:00
TeleBot Fix: Variant selection now accumulates across types instead of resetting 2025-10-06 02:44:28 +01:00
TeleBot.Tests CI/CD: Add GitLab CI/CD pipeline for Hostinger deployment 2025-10-01 13:10:48 +01:00
TeleBotClient Initial commit of LittleShop project (excluding large archives) 2025-09-17 15:07:38 +01:00
test-results Cleanup: Update .gitignore and verify TOR implementation 2025-10-01 16:20:16 +01:00
.env.example Initial commit of LittleShop project (excluding large archives) 2025-09-17 15:07:38 +01:00
.env.multi.example Configure BTCPay with external nodes via Tor 2025-09-19 12:14:39 +01:00
.env.production.example Add TeleBot CI/CD pipeline configuration 2025-09-27 09:53:43 +01:00
.gitignore Cleanup: Update .gitignore and verify TOR implementation 2025-10-01 16:20:16 +01:00
.gitlab-ci.yml Add TeleBot CI/CD pipeline configuration 2025-09-27 09:53:43 +01:00
deploy-bot.sh Configure BTCPay with external nodes via Tor 2025-09-19 12:14:39 +01:00
DEPLOYMENT.md Initial commit of LittleShop project (excluding large archives) 2025-09-17 15:07:38 +01:00
docker-compose.hostinger.yml Add TeleBot Hostinger deployment configuration with source build 2025-09-24 18:12:27 +01:00
docker-compose.multi.yml Configure BTCPay with external nodes via Tor 2025-09-19 12:14:39 +01:00
docker-compose.production.yml Add TeleBot CI/CD pipeline configuration 2025-09-27 09:53:43 +01:00
docker-compose.yml Initial commit of LittleShop project (excluding large archives) 2025-09-17 15:07:38 +01:00
INTEGRATION_SUMMARY.md Add customer communication system 2025-08-27 18:02:39 +01:00
MULTI-HOST-DEPLOYMENT.md Configure BTCPay with external nodes via Tor 2025-09-19 12:14:39 +01:00
portainer-template.json Configure BTCPay with external nodes via Tor 2025-09-19 12:14:39 +01:00
README.md Add customer communication system 2025-08-27 18:02:39 +01:00
TEST_DOCUMENTATION.md Add customer communication system 2025-08-27 18:02:39 +01:00
TESTING-AND-VERIFICATION.md CI/CD: Add GitLab CI/CD pipeline for Hostinger deployment 2025-10-01 13:10:48 +01:00
TOR-IMPLEMENTATION-SUMMARY.md CI/CD: Add GitLab CI/CD pipeline for Hostinger deployment 2025-10-01 13:10:48 +01:00

TeleBot - Privacy-First E-Commerce Telegram Bot

A privacy-focused Telegram bot for the LittleShop e-commerce platform, featuring anonymous shopping, cryptocurrency payments, and optional Tor support.

🔒 Privacy Features

  • No Account Required: Shop anonymously without registration
  • Ephemeral Sessions: Data auto-deletes after 30 minutes of inactivity
  • PGP Encryption: Optional encryption for shipping information
  • Tor Support: Can operate through Tor network for maximum privacy
  • Anonymous References: Orders use random identifiers, not user IDs
  • Cryptocurrency Only: Bitcoin, Monero, and other privacy coins
  • Zero Analytics: No tracking unless explicitly enabled
  • Data Deletion: Delete all your data instantly with /delete

🚀 Quick Start

Prerequisites

  • .NET 9.0 SDK
  • Telegram Bot Token (from @BotFather)
  • LittleShop API running locally or accessible
  • (Optional) Redis for persistent sessions
  • (Optional) Tor for anonymous routing

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/littleshop.git
cd littleshop/TeleBot/TeleBot
  1. Configure the bot:
cp appsettings.json appsettings.Production.json
# Edit appsettings.Production.json with your settings
  1. Set your bot token:
{
  "Telegram": {
    "BotToken": "YOUR_BOT_TOKEN_FROM_BOTFATHER"
  },
  "LittleShop": {
    "ApiUrl": "https://localhost:5001",
    "Username": "bot-user",
    "Password": "bot-password"
  }
}
  1. Run the bot:
dotnet run --environment Production

📱 Bot Commands

Shopping Commands

  • /start - Start shopping and view main menu
  • /browse - Browse product categories
  • /cart - View your shopping cart
  • /orders - View your order history
  • /clear - Clear shopping cart

Privacy Commands

  • /privacy - Privacy settings menu
  • /ephemeral - Toggle ephemeral mode
  • /pgpkey [key] - Set PGP public key for encryption
  • /delete - Delete all your data immediately
  • /tor - Get Tor configuration instructions

Help

  • /help - Show all available commands

🛍️ Shopping Flow

  1. Browse Products

    • Start with /browse or main menu
    • Select category → View products → Select product
  2. Add to Cart

    • Choose quantity with +/- buttons
    • Click "Add to Cart"
    • Continue shopping or checkout
  3. Checkout

    • Click "Proceed to Checkout" from cart
    • Enter shipping information step-by-step:
      • Name
      • Address
      • City
      • Postal Code
      • Country
    • Review and confirm order
  4. Payment

    • Select cryptocurrency (BTC, XMR, USDT, etc.)
    • Receive wallet address and amount
    • QR code generated for easy payment
    • Payment expires after set time
  5. Order Tracking

    • Use /orders to view all orders
    • Click on order to see details
    • Track payment and shipping status

🔐 Privacy Configuration

Ephemeral Mode (Default: ON)

{
  "Privacy": {
    "EphemeralByDefault": true,
    "DataRetentionHours": 24,
    "SessionTimeoutMinutes": 30
  }
}

PGP Encryption

Users can enable PGP encryption for shipping information:

/pgpkey -----BEGIN PGP PUBLIC KEY BLOCK-----
[Your PGP public key here]
-----END PGP PUBLIC KEY BLOCK-----

Tor Configuration

Enable Tor routing for all bot communications:

{
  "Privacy": {
    "EnableTor": true,
    "TorSocksPort": 9050,
    "TorControlPort": 9051
  }
}

Redis Session Storage (Optional)

For non-ephemeral sessions across bot restarts:

{
  "Redis": {
    "Enabled": true,
    "ConnectionString": "localhost:6379",
    "InstanceName": "TeleBot"
  }
}

🧅 Tor Setup

1. Install Tor

# Ubuntu/Debian
sudo apt install tor

# Start Tor service
sudo systemctl start tor

2. Configure Hidden Service

Edit /etc/tor/torrc:

HiddenServiceDir /var/lib/tor/telebot/
HiddenServicePort 80 127.0.0.1:5000
HiddenServiceVersion 3

3. Get Onion Address

sudo cat /var/lib/tor/telebot/hostname

4. Configure Bot

{
  "Privacy": {
    "EnableTor": true,
    "OnionServiceDirectory": "/var/lib/tor/telebot/"
  },
  "LittleShop": {
    "OnionUrl": "http://your-shop-onion.onion",
    "UseTor": true
  }
}

🚢 Deployment

Docker

FROM mcr.microsoft.com/dotnet/runtime:9.0
WORKDIR /app
COPY ./publish .
ENTRYPOINT ["dotnet", "TeleBot.dll"]

Docker Compose with Tor

version: '3.8'
services:
  telebot:
    build: .
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - Privacy__EnableTor=true
    volumes:
      - ./appsettings.Production.json:/app/appsettings.Production.json
      - ./data:/app/data
    depends_on:
      - tor
      - redis
    
  tor:
    image: dperson/torproxy
    ports:
      - "9050:9050"
      - "9051:9051"
    volumes:
      - ./tor:/etc/tor
      - tor_data:/var/lib/tor
    
  redis:
    image: redis:alpine
    command: redis-server --save ""
    volumes:
      - redis_data:/data

volumes:
  tor_data:
  redis_data:

Systemd Service

[Unit]
Description=TeleBot Privacy E-Commerce Bot
After=network.target

[Service]
Type=simple
User=telebot
WorkingDirectory=/opt/telebot
ExecStart=/usr/bin/dotnet /opt/telebot/TeleBot.dll
Restart=on-failure
Environment=ASPNETCORE_ENVIRONMENT=Production

[Install]
WantedBy=multi-user.target

🔧 Advanced Configuration

Supported Cryptocurrencies

{
  "Cryptocurrencies": [
    "BTC",   // Bitcoin
    "XMR",   // Monero (recommended for privacy)
    "USDT",  // Tether
    "LTC",   // Litecoin
    "ETH",   // Ethereum
    "ZEC",   // Zcash
    "DASH",  // Dash
    "DOGE"   // Dogecoin
  ]
}

Order Mixing (Privacy Feature)

Adds random delays to order processing:

{
  "Features": {
    "EnableOrderMixing": true,
    "MixingDelayMinSeconds": 60,
    "MixingDelayMaxSeconds": 300
  }
}

Disappearing Messages

Auto-delete sensitive messages after display:

{
  "Features": {
    "EnableDisappearingMessages": true,
    "DisappearingMessageTTL": 30
  }
}

📊 Monitoring

Logs

  • Console output for real-time monitoring
  • File logs in logs/telebot-YYYYMMDD.txt
  • Privacy-safe logging (no PII)

Health Check

curl http://localhost:5000/health

🔒 Security Best Practices

  1. Never commit real bot tokens - Use environment variables
  2. Run as non-root user in production
  3. Use HTTPS for API connections
  4. Enable Tor for maximum privacy
  5. Rotate bot tokens regularly
  6. Monitor for abuse - Implement rate limiting
  7. Backup PGP keys securely
  8. Use strong passwords for API authentication

🐛 Troubleshooting

Bot not responding

  • Check bot token is correct
  • Ensure bot is not blocked
  • Check network connectivity
  • Review logs for errors

Can't connect to API

  • Verify LittleShop API is running
  • Check API credentials
  • Test API connection manually
  • Check firewall rules

Tor connection issues

  • Ensure Tor service is running
  • Check SOCKS proxy settings
  • Verify onion address is correct
  • Check Tor logs: sudo journalctl -u tor

Session issues

  • Clear Redis cache if enabled
  • Delete telebot.db if using LiteDB
  • Restart bot service
  • Check session timeout settings

📝 Privacy Policy

This bot implements privacy-by-design principles:

  • Minimal data collection
  • Ephemeral by default
  • No third-party tracking
  • User-controlled data deletion
  • Optional encryption
  • Anonymous identifiers
  • No KYC requirements

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

📄 License

This project is part of the LittleShop platform. All rights reserved.

🆘 Support

🔮 Roadmap

  • Voice message support for product search
  • Group shopping carts
  • Multi-language support
  • Web app integration
  • Lightning Network payments
  • Decentralized order storage (IPFS)
  • AI-powered product recommendations
  • End-to-end encrypted group orders

Remember: Your privacy is our priority. Shop safely! 🔒