FunPay Cardinal Documentation

repository·main·Indexed 19 days ago

https://github.com/sidor0912/funpaycardinal

A lightweight Python-based automation bot for FunPay sellers. It features automated product delivery, lot management (auto-bump and restoration), and a full control interface via Telegram. The bot supports extensibility through a plugin system and can be deployed on Windows, Ubuntu, or via Docker.

Tokens
1.9K
Snippets
6
Records
10
Agent score
65%

What's inside FunPay Cardinal

  1. Overview of FunPay Cardinal features

    main

    FunPay Cardinal is an automation bot for FunPay with the following capabilities:

    FunPay Automation

    • Automatic product delivery (Auto-delivery).
    • Automatic lot lifting (Auto-bump).
    • Auto-responses to predefined commands.
    • Automatic lot restoration after sale.
    • Automatic lot deactivation when stock is empty.
    • Permanent online status.

    Telegram Control & Notifications

    • Full Control Panel (PU) via Telegram.
    • Notifications for: lot lifting, new orders, product delivery, and new messages.
    • Ability to reply to messages directly from Telegram.
    • Configure auto-delivery and auto-responder modules via Telegram.

    Extensibility

    • Use variables in auto-response/auto-delivery text.
    • Plugin system for custom functionality.
  2. Install plugins via Telegram

    main

    Plugins allow for custom functionality without editing the core source code. Warning: Only install plugins from trusted sources, as they can gain full access to your FunPay account.

    To install a plugin:

    1. Open your chat with the FunPay Cardinal bot in Telegram.
    2. Send the command /menu.
    3. Tap the 🧩 Плагины (Plugins) button.
    4. Tap the ➕ Добавить плагин (Add plugin) button.
    5. Send or forward the plugin file to the bot.
  3. Install FunPay Cardinal on Linux (Ubuntu)

    main

    To install on Ubuntu, use the automated installation script which installs all dependencies and runs the bot as a background process:

    1. Execute the following command in your terminal: wget https://raw.githubusercontent.com/sidor0912/FunPayCardinal/main/install-fpc.sh -O install-fpc.sh && bash install-fpc.sh
    2. Follow the on-screen instructions provided by the installer.
    wget https://raw.githubusercontent.com/sidor0912/FunPayCardinal/main/install-fpc.sh -O install-fpc.sh && bash install-fpc.sh
  4. Install FunPay Cardinal on Windows

    main

    To install FunPay Cardinal on Windows, follow these steps:

    1. Install Python: Download and install Python 3.11.0. Crucial: During installation, check the box Add python.exe to PATH on the first screen.
    2. Download Project: Download the FunPay Cardinal source archive.
    3. Extract: Move the FunPayCardinal-main.zip archive to your desired location and extract it.
    4. Setup: Open the FunPayCardinal-main folder and run Setup.bat. Wait for all packages to finish downloading.
    5. Run: Close the command prompt window once setup is complete, then run Start.bat to launch the bot.
    Setup.bat
    Start.bat
  5. Install FunPay Cardinal via Docker

    main

    To run FunPay Cardinal using Docker, ensure you have Docker Desktop (Windows/Mac) or Docker Engine + Docker Compose (Linux) installed.

    1. Prepare Files: Download the FunPay Cardinal archive and extract it, or clone the repository.
    2. Build Image: Navigate to the project folder and run: docker compose build
    3. Initial Configuration: Because the first run requires interactive input (login, tokens, etc.), run a one-time interactive container: docker compose run --rm funpaycardinal Follow the setup wizard prompts in the terminal.
    4. Run in Background: Once configured, start the bot in detached mode: docker compose up -d

    Note: The directories configs, logs, storage, and plugins are mounted from the host to the container, ensuring data persistence across restarts.

    docker compose build
    docker compose run --rm funpaycardinal
    docker compose up -d
  6. Run FunPay Cardinal as a Linux service

    main

    When running on Linux, you can run FunPay Cardinal as a service. If the environment variable FPC_IS_RUNNIG_AS_SERVICE is set to '1', the application will create a PID file to track the process.

    PID File Location

    The PID file is stored at: /run/FunPayCardinal/{username}/FunPayCardinal.pid

    This allows service managers to monitor and manage the process lifecycle.

  7. Initialize and run FunPay Cardinal

    main

    The main entrypoint of the application initializes the environment, loads necessary configurations, and starts the Cardinal execution loop.

    Initialization Flow

    1. Dependency Check: Automatically attempts to install lxml, bcrypt, and pysocks via pip if they are missing.
    2. Directory Setup: Creates essential directories: configs, logs, storage, storage/cache, storage/plugins, storage/products, and plugins.
    3. Configuration Loading: Loads three primary configuration files:
      • configs/_main.cfg: Main application settings.
      • configs/auto_response.cfg: Auto-response settings.
      • configs/auto_delivery.cfg: Auto-delivery settings.
    4. Execution: Initializes the Cardinal class with the loaded configurations and starts the .run() loop.

    Required Configuration Files

    If the following files do not exist, the application will attempt to create them or trigger first_setup():

    • configs/_main.cfg (Critical: triggers first_setup() if missing)
    • configs/auto_response.cfg
    • configs/auto_delivery.cfg

    Error Handling

    • ConfigParseError: Occurs if configuration files are malformed.
    • UnicodeDecodeError: Occurs if config files are not encoded in UTF-8 with LF line endings.
    • KeyboardInterrupt: Gracefully shuts down the application on user interrupt.
    # To run the application, execute the main script
    python main.py
  8. Deploy FunPay Cardinal using Docker Compose

    main

    You can deploy FunPay Cardinal as a Docker container using the provided docker-compose.yml. The service is configured to restart automatically unless manually stopped and requires interactive terminal support (stdin_open and tty).

    To ensure data persistence and configuration management, the following host directories must be mapped to the container:

    • ./configs: Stores application configuration files.
    • ./logs: Stores application log files.
    • ./storage: Stores application data/storage.
    • ./plugins: Stores external plugins.
    services:
      funpaycardinal:
        build: .
        container_name: funpaycardinal
        restart: unless-stopped
        stdin_open: true
        tty: true
        volumes:
          - ./configs:/app/configs
          - ./logs:/app/logs
          - ./storage:/app/storage
          - ./plugins:/app/plugins
  9. Configure FunPay Cardinal via config files

    main

    FunPay Cardinal relies on several .cfg files located in the configs/ directory. The application uses Utils.config_loader to parse these files.

    Primary Configuration Files

    FilePurpose
    configs/_main.cfgMain application configuration. Contains the Other section where the language key is defined.
    configs/auto_response.cfgConfiguration for the auto-response module.
    configs/auto_delivery.cfgConfiguration for the auto-delivery module.

    Important Notes

    • Encoding: All configuration files must be encoded in UTF-8 and use LF line endings to avoid UnicodeDecodeError.
    • Language: The language setting is controlled via MAIN_CFG["Other"]["language"] within _main.cfg and is used to initialize the Localizer.
  10. Manage Docker containers for FunPay Cardinal

    main

    Use these commands to manage your running FunPay Cardinal Docker instance:

    • View Logs: docker compose logs -f
    • Attach to Console: docker attach funpaycardinal (To detach without stopping the container, press Ctrl+P then Ctrl+Q).
    • Stop Bot: docker compose down.
    docker compose logs -f
    docker attach funpaycardinal
    docker compose down