You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
679 B
24 lines
679 B
const {globalFunc} = customJS;
|
|
let {items} = input;
|
|
let ing = [];
|
|
let j = 0;
|
|
|
|
if (!Boolean(items)) {
|
|
return "⚠️ <b>Warning</b>\nYou have not specified ahoppong items!\n<b>The shopping list cannot be printed.</b>"
|
|
}
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
let name = items[i].replace(items[i].split(" ")[0] + " " + items[i].split(" ")[1]+ " " + items[i].split(" ")[2], "");
|
|
let unit = items[i].split(" ")[2];
|
|
if (unit.contains('whole')) {unit = ""}
|
|
let amount = items[i].split(" ")[1];
|
|
let emoji = items[i].split(" ")[0];
|
|
|
|
if (amount > 0) {
|
|
ing[j] = emoji + " " + amount + " " + unit + " <b>" + name + "</b>"
|
|
j++
|
|
}
|
|
}
|
|
|
|
dv.el('p', globalFunc.BuildList(ing, "\n"))
|