Skip to main content

Add-Item command

this command would allow admins to add items in the shop.

  • /add item

Demo

Arguments and Permissions

Arguments

ArgumentsDescriptionTypeValuesRequired
idid of the item - no special characters allowedTextMax Length : 50True
namename of itemTextMax Length : 50
priceprice for the itemWhole Number
descriptionshort description of the itemTextMax Length : 150
reward_rolerole to give as rewardRole
required_rolerole required to buy this itemRoleFalse
stockremaining stock for the itemWhole Number
responseextra notes to add in response when someone buys this itemTextMax Length : 150

Command Permissions

MANAGE GUILD or ADMIN, modify it according to you.

Flow

Get Stored Variable

  • Variable : shop
  • Set Temporary Variable : shop

Calculate Value

  • Temporary Variable : shop_item
let list = var('shop') ?? [];
let idregex = `[^a-zA-Z0-9\s]{1,}`;
let id = arg('id') | lower() | replace(" ", "_");

none(list, {.id == id}) && none(list, {.role == arg('reward_role').id}) && ! (arg('id') matches idregex) ?
concat(list, [
{
"id": arg('id') | lower() | replace(" ", "_"),
"name": arg('name'),
"stock": arg('stock'),
"role": arg('reward_role').id,
"require": arg('required_role')?.id,
"price": arg('price'),
"desc": arg('description'),
"response": arg('response')
}
])
:
"- IDs cannot have special characters + There cannot be two items with the same ID and reward role."

Comparison Condition

  • Base Value : {{type(var('shop_item'))}}

Match Condition


Comparison ModeComparison Value
Equalarray
  1. Set stored variable

    • Variable : shop
    • Operation : Overwrite
    • Value : {{var('shop_item')}}
  2. Create Response Message

    • Add embed
    • Embed Title : done 👌
    • Embed Description :
Embed Description
```json
{{var('shop_item') | last() | toJSON()}}```

Else


  • Create Response Message
📋 Paste this in your response message
{{var('shop_item')}}