Skip to content

lethinh26/Lime-Store-DS-Python

Repository files navigation

🍋 Lime Store Discord Bot - Complete E-Commerce Solution

Python Discord.py MongoDB

🎯 Features (Version 2.0.0 - Complete)

🎫 Ticket System

  • ✅ Create/close tickets with auto-categorization (support, purchase, bug, refund)
  • NEW: Assign tickets to specific support staff
  • ✅ Auto-close after 15 minutes of inactivity
  • ✅ DM notifications when staff replies or closes ticket
  • ✅ Per-staff statistics and overall performance metrics
  • ✅ Full logging to configured channel

🛍️ Shop System

  • ✅ Product catalog with dropdown select menu
  • ✅ Per-user shopping cart
  • NEW: Complete checkout with VietQR payment QR codes
  • ✅ Auto-updating embed when stock changes
  • ✅ Restock notifications to dedicated channel
  • ✅ Full logging of all shop activities

💳 Payment System (NEW!)

  • VietQR Integration - Auto-generate QR codes for Vietnamese banks
  • Order Management - Track all orders with status (pending/completed/failed/cancelled)
  • Payment Confirmation - Support staff confirm payments with button click
  • Auto Notifications - Ping support and DM customer when payment confirmed
  • ✅ Fallback to manual payment if VietQR not configured

🎁 Voucher System (NEW!)

  • Personal Vouchers - Each user has their own unique vouchers
  • Percentage or Fixed Discount - Flexible discount types
  • Usage Limits - Control how many times vouchers can be used
  • Expiration Dates - Set voucher expiry
  • Min/Max Purchase - Minimum purchase amount and maximum discount cap
  • Auto-Apply - Automatically apply during checkout

🎁 Combo & Discount (NEW!)

  • Bundle Products - Create combos with multiple products
  • Percentage Discounts - Set discount percentage for combos
  • Stock Management - Track combo stock separately
  • Price Comparison - Show original vs combo price

📢 Announcement System (NEW!)

  • Role-Based Notifications - Ping specific role for announcements
  • New Product Announcements - Notify customers about new products
  • Flash Sales - Create flash sale announcements with duration
  • Rich Embeds - Professional-looking announcements

📊 Additional Features

  • ✅ Real-time product updates using MongoDB Change Streams (with polling fallback)
  • ✅ Comprehensive order history for customers
  • ✅ Support performance tracking
  • ✅ Auto-restock notifications
  • ✅ Complete audit logging

📋 Requirements

  • Python 3.10+
  • Discord Bot with appropriate intents enabled (Members, Messages, Guilds)
  • MongoDB (Atlas or self-hosted)
    • Replica Set recommended for Change Streams
    • Polling fallback available for standalone instances

🚀 Quick Start

1. Clone & Install

# Install dependencies
pip install -r requirements.txt

2. Configure Environment

Copy .env.example to .env and fill in your values:

DISCORD_TOKEN=
MONGO_URI=
MONGO_DB=

# VietQR/Payment 
VIETQR_BANK_ID=970422
VIETQR_ACCOUNT_NO=your_account_number
VIETQR_ACCOUNT_NAME=YOUR NAME
VIETQR_TEMPLATE_ID=compact

# Payment Webhook (auto-detect payment)
PAYMENT_WEBHOOK_ENABLED=false
PAYMENT_WEBHOOK_SECRET=your_webhook_secret_key
PAYMENT_WEBHOOK_PORT=8080
PAYMENT_WEBHOOK_URL="http://localhost:8080/webhook/payment"


# Optional: Default guild for quicker initial setup (not working)
DEFAULT_GUILD_ID=

3. Migrate Database

python migrate.py

4. Test Installation

python test_imports.py

5. Test Webhook

python test_webhook.py

6. Run Bot

python bot.py

⚙️ Initial Configuration (In Discord)

Step 1: Basic Setup

/setup
  ticket_category: Select category for tickets
  support_role: Select support staff role
  shop_channel: Select shop display channel
  restock_channel: Select restock notification channel
  logs_channel: Select audit log channel

Step 2: Shop Setup

/shop_setup

This creates the shop message with product dropdown and buttons.

Step 3: Announcement Setup

/announce_role_set @CustomerRole

Set the role to ping for announcements.

Step 4: Add Products

/product_add "Product Name" "Description" 100000 50

Add products to your shop (price in VND, stock quantity).


📚 Documentation


🎮 Command Reference

For Customers

/ticket <subject>              # Create support ticket
/checkout [voucher]            # Checkout cart with optional voucher
/order_history                 # View order history
/order_detail <order_id>       # View specific order details
/voucher_list                  # View your available vouchers
/combo_list                    # View available combos

For Support Staff

/ticket_assign @staff          # Assign ticket to staff member
/ticket_close [reason]         # Close current ticket
/ticket_stats                  # View ticket statistics
  • Payment Confirmation Button in order tickets

For Admins

# Product Management
/product_add name desc price stock
/product_stock name new_stock
/product_toggle name true/false
/product_restock name +amount

# Voucher Management
/voucher_create @user type value [options]
/voucher_deactivate code

# Combo Management
/combo_create name desc "prod1,prod2" discount% stock
/combo_toggle name active
/combo_stock name stock

# Announcements
/announce_new_product product message
/announce_flash_sale title desc minutes

💎 Key Features Explained

VietQR Payment Flow

  1. Customer adds products to cart
  2. Customer runs /checkout [voucher]
  3. Bot generates QR code with VietQR API
  4. Bot creates order + ticket with invoice embed
  5. Customer scans QR and transfers money
  6. Support staff verifies payment
  7. Support clicks "✅ Xác nhận đã thanh toán" button
  8. Bot updates order status and notifies everyone
  9. Support delivers product/key
  10. Support closes ticket

Voucher System

  • Personal vouchers - Each user gets unique vouchers
  • Flexible discounts - Percentage or fixed amount
  • Smart validation - Automatic checks for expiry, usage limits, minimum purchase
  • Seamless integration - Just add voucher code during checkout

Combo System

  • Bundle products - Group multiple products together
  • Attractive pricing - Show savings vs buying individually
  • Independent stock - Track combo availability separately

🗄️ Database Structure

Collections

  • config - Bot configuration
  • tickets - Support tickets
  • products - Product catalog
  • carts - User shopping carts
  • orders - Order history and tracking
  • vouchers - Personal discount vouchers
  • combos - Product combo bundles
  • logs - System audit logs

🔐 Security Features

  • ✅ Role-based permission checks
  • ✅ Personal voucher system (no sharing)
  • ✅ Order access control (owner or support only)
  • ✅ Payment confirmation requires support role
  • ✅ Input validation on all user inputs
  • ✅ Proper error handling throughout

🎯 Use Cases

Perfect for:

  • Discord server shops
  • Gaming communities selling items/keys
  • Digital product sales
  • Service-based businesses
  • Community fundraising
  • Event ticket sales

🤝 Support


📊 Statistics

  • 16 new files created
  • 5 existing files updated
  • 15+ new commands added
  • 3 new database collections
  • 8 major features implemented

🎉 What's New in v2.0.0

8 Major New Features:

  1. Ticket assignment system
  2. VietQR payment integration
  3. Complete order management
  4. Personal voucher system
  5. Combo & discount system
  6. Announcement system
  7. Enhanced restock notifications
  8. Payment confirmation workflow

See CHANGELOG.md for complete details.


📄 License

This project is created for educational and commercial use.


🙏 Credits

Built with:


Made with ❤️ for Lime Store Version 2.0.0 - Complete E-Commerce Solution

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages