nyx/commands/Economy/shop.js
2021-06-24 15:53:19 +08:00

28 lines
946 B
JavaScript

const { Client, Message, MessageEmbed } = require("discord.js");
const util = require("../../util/pagination/pagination");
const items = require("../../util/dist/item");
module.exports = {
name: "shop",
description: "Check the items from the shop",
category: "Economy",
run: async (client, message, args) => {
const list = items.map((value, index) => {
return `**${value.item}** — ${value.price.toLocaleString()}${
client.currency
}\nID: \`${value.id}\``;
});
const c = util.chunk(list, 5).map(x => x.join("\n\n"));
const embed = new MessageEmbed()
.setTitle("**cath.exe shop**")
.setTimestamp()
.setDescription(c[0])
.setColor(client.color)
.setFooter(`Page 1 of ${c.length}`);
try {
const msg = await message.channel.send(embed);
if (list.length > 5) await util.pagination(msg, message.author, c);
} catch (e) {
console.log(e);
}
},
};