# Product Panel

### Key Features

* **Interactive Panels** → Use buttons or dropdown menus to deliver products
* **Smart Placeholder Injection** → Auto-replace placeholders with user data
* **Image & ZIP Support** → Process text inside images and zip archives safely
* **Database Integration** → Store unique user IDs for consistent downloads
* **Tracking & Analytics** → See who downloaded what, and when
* **Role-Based Access** → Restrict products to certain roles
* **Cooldowns** → Prevent spam downloads with custom cooldown timers

***

####

#### Configuration

Edit `config.yml` to define your panels, products, and permissions.

Example:

{% code expandable="true" %}

```yaml
ProductPanelRole: ["ROLE_ID_HERE"]  # Roles allowed to manage panels

panels:
  YourPanel:
    SelectMenu: true
    Title: "Your Product Panel"
    Description:
      - "**Choose a product to download:**"
      - "📦 **Standard Release** - $9.99"
      - "[Purchase Link](https://example.com)"
    Footer:
      Text: "Download your files today"
    Color: "#1769FF"

    products:
      - name: "Standard"
        emoji: "📦"
        description: "Standard Download"
        roleId: "REQUIRED_ROLE_ID"
        zipFilePath: "./products/YourPanel/Standard"
        buttonLabel: "Download Standard"
        buttonColor: "PRIMARY"
    
    cooldownDuration: 60  # seconds
```

{% endcode %}

Messages, logging embeds, and error handling are also customizable in `config.yml`.

***

### Placeholder System

You can inject placeholders into text, code, zip contents, or even jars.

| Placeholder         | Description           | Example                |
| ------------------- | --------------------- | ---------------------- |
| `%%_DISCORD_ID_%%`  | User’s Discord ID     | `123456789012345678`   |
| `%%_USERNAME_%%`    | User’s name           | `johndoe`              |
| `%%_RESOURCE_%%`    | Product name          | `Standard`             |
| `%%_TIMESTAMP_%%`   | Download time         | `2024-01-15T10:30:00Z` |
| `%%_UNIQUE_ID_X_%%` | Random ID of X length | `yDxY_Gr=9$Fw`         |

* Each user always gets the **same IDs** for each length.
* IDs are saved in MongoDB, so they stay consistent across products.
* Supports IDs of 3–32 characters with letters, numbers, and symbols.

{% hint style="success" %} <mark style="color:green;">**Hint:**</mark> Put these placeholders anywhere in your files and they'll be replaced on download
{% endhint %}

{% hint style="danger" %} <mark style="color:red;">**Important:**</mark> Make sure you replace **X** with a valid number (e.g., 4). Length **must** be more than 3.
{% endhint %}

***

### Supported File Types

The Product Panel can process placeholders in a wide range of files.

#### Text Files (inline replacement)

Includes most programming, config, and text formats:

* **Code:** `.js`, `.ts`, `.jsx`, `.tsx`, `.py`, `.php`, `.rb`, `.go`, `.rs`, `.java`, `.cpp`, `.c`, `.cs`, `.swift`, `.kt`, `.scala`, `.rb`, `.pl`, `.lua`, `.sh`, `.ps1`, `.bat, .jar`&#x20;
* **Web:** `.html`, `.htm`, `.css`, `.scss`, `.sass`, `.less`, `.xml`
* **Config & Data:** `.json`, `.yaml`, `.yml`, `.toml`, `.ini`, `.cfg`, `.properties`, `.env`
* **Docs & Logs:** `.txt`, `.md`, `.log`, `.sql`
* **Dev Tools:** `.gitignore`, `.editorconfig`, `.eslintrc`, `.prettierrc`, `.babelrc`, `.tsconfig`, `.dockerfile`, `.makefile`

*(and many other common scripting, package, and project files)*

#### Images (non-destructive)

* `.png`, `.jpg`, `.jpeg`, `.gif`, `.bmp`, `.ico`, `.svg`, `.webp`, `.tiff`, `.tif`

Placeholders are injected without breaking the image.

#### Archives (extract & repackage)

* `.zip`

Contents are unpacked, processed, and zipped back up automatically.

***

### Commands

* `/product create <panel>` → Post a product panel in a channel
* `/product list` → See all configured panels
* `/product stats <panel>` → View download stats for a panel
* `/product history [user]` → Show a user’s download history
* `/product trace [target|data]` → Advanced lookup (by user, Discord ID, username, or placeholder data)

***

### Best Practices

1. Use placeholders in configs, docs, and metadata to personalize downloads
2. Test downloads to make sure placeholders replace correctly
3. Watch file sizes (Discord’s limit is 8MB by default, up to 100MB with boosts)

***

### Troubleshooting

* **Placeholders not replaced** → Check file type and syntax (`%%_PLACEHOLDER_%%`)
* **Image corruption** → Only insert placeholders at the end of images
* **Permission errors** → Verify `ProductPanelRole` and per-product `roleId`
* **File too large** → Compress or remove unnecessary files

***

### Support

If you run into issues:

1. Double-check your config formatting
2. Use `/product trace` to debug user data
3. Review console logs for errors
