item transfer, item to buy other items, item income, unbuyable items
This commit is contained in:
@@ -13,12 +13,12 @@ async function run(interaction: ChatInputCommandInteraction) {
|
||||
const delete_existing_roles: boolean = (await options.get("delete_existing_roles")).value as boolean;
|
||||
const item = await get_item(name);
|
||||
if (!item) throw new BotError("No item of that name exists");
|
||||
const price: number = ((await options.get("price"))?.value ?? item.price) as number;
|
||||
const price = ((await options.get("price"))?.value ?? item.price) as (number | undefined);
|
||||
const description: string = ((await options.get("description"))?.value ?? item.description) as string;
|
||||
const usable: boolean = ((await options.get("usable"))?.value ?? item.usable) as boolean;
|
||||
//to add multiple roles, people will have to use /edit_item, I guess? augh
|
||||
const required_role = (await options.get("required_role"))?.role;
|
||||
if (price < 0) throw new BotError("Price cannot be negative");
|
||||
if (price <= 0) throw new BotError("Price cannot be zero or negative");
|
||||
//name and description char limits (based on discord embed field name/value limits)
|
||||
if (description.length > 900) throw new BotError("Item description cannot be more than 1024 characters"); //true limit is 1024 but we want some margin for other info
|
||||
const existing = delete_existing_roles ? [] : item.roles_required;
|
||||
|
||||
Reference in New Issue
Block a user