# Discord Automation

### Overview

This guide explains how to automate license issuance in SunLicense using the Discord bot. Once a user receives the designated product-purchased role, they can claim a license key for that product without direct contact with you.

### Step 1: Assigning a Product Purchased Role in SunLicense

When creating a product in SunLicense, you can specify a **Product Purchased Discord Role ID**. This role should be given to users upon purchasing the product through your system or any other sales system.

#### If You Are Creating a New Product:

1. Go to the **Products** page in the SunLicense dashboard.
2. Click **Create Product**.
3. Enter all necessary product details.
4. Find the **Product Purchased Role ID** field.
5. Enter the **Discord Role ID** that represents users who have purchased this product.
6. Save the product.

#### If You Already Have an Existing Product:

1. Go to the **Products** page.
2. Click **Manage Products**.
3. Select the product you want to update.
4. Locate the **Product Purchased Role ID** field.
5. Enter or update the **Discord Role ID**.
6. Save the changes.

### Step 2: Assigning the Role to Users

* Ensure that your system (or any other sales platform) grants the **Product Purchased Role** to a user when they buy the product.
* This role acts as proof that the user has purchased the product.

### Step 3: License Claiming with `/get-license` Command

Once a user receives the **Product Purchased Role**, SunLicense will recognize them as a valid purchaser.

#### How Users Can Claim a License:

1. Join your Discord server.
2. Ensure they have the required **Product Purchased Role**.
3. Execute the `/get-license` command in the designated Discord channel.
4. SunLicense will automatically issue a license key for the product.
5. The user will receive their license key immediately.

### Notes

* The **Product Purchased Role** should be granted when a user buys the product.
* Users must have the correct role before executing `/get-license`.
* This automation removes the need for manual license distribution.

### Conclusion

By following this guide, you can streamline the license issuance process, allowing users to claim their licenses effortlessly via Discord. 🚀
