Edit-Item command
this command would allow admins to edit items in the shop.
/edit item

tip
You can just duplicate the add-item command and edit the blocks as this command is almost identical to the previous one.
What's Changed?
- Arguments - some arguments are changed from Required: true to Required: false
- Calculate Value Blocks
everything else is same as the previous command!
🛠️ Arguments and Permissions
Arguments
| Arguments | Description | Type | Values | Required |
|---|---|---|---|---|
id | id of the item - no special characters allowed | Text | Max Length : 50 | True |
name | name of item | Text | Max Length : 50 | False |
price | price for the item | Whole Number | ||
description | short description of the item | Text | Max Length : 150 | |
reward_role | role to give as reward | Role | ||
required_role | role required to buy this item | Role | ||
stock | remaining stock for the item | Whole Number | ||
response | extra notes to add in response when someone buys this item | Text | Max Length : 150 |
Command Permissions
MANAGE GUILD or ADMIN, modify it according to you.
Get Stored Variable
- Variable : shop
- Set Temporary Variable :
shop
Calculate Value
- Temporary Variable :
shop_item
Expression
let list = var('shop') ?? [];
let item = findIndex(list, .id == arg('id'));
item != nil ?
map(list, #index == item ?
{
"id": .id,
"stock": arg('stock') ?? .stock,
"name": arg('name') ?? .name,
"role": arg('reward_role')?.id ?? .role,
"require": arg('required_role')?.id ?? .require,
"price": arg('price') ?? .price,
"desc": arg('description') ?? .desc,
"response": arg('response') ?? .response
}
: #)
:
"## ⚠️ Item not in list."
Comparison Condition
- Base Value :
{{type(var('shop_item'))}}
Match Condition
| Comparison Mode | Comparison Value |
|---|---|
| Equal | array |
-
Set stored variable
- Variable : shop
- Operation : Overwrite
- Value :
{{var('shop_item')}}
-
Create Response Message :
done 👌
Else
- Create Response Message :
{{var('shop_item')}}