nyx/command/Economy/shop.js

29 lines
949 B
JavaScript
Raw Normal View History

const { MessageEmbed } = require("discord.js");
2021-06-24 09:53:19 +02:00
const util = require("../../util/pagination/pagination");
const items = require("../../util/dist/item");
2021-06-12 12:53:51 +02:00
module.exports = {
name: "shop",
description: "Check the items from the shop",
category: "Economy",
run: async (client, interaction, args) => {
2021-06-12 12:53:51 +02:00
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 interaction.followUp({ embeds: [embed] });
if (list.length > 5) await util.pagination(msg, interaction.user, c);
2021-06-12 12:53:51 +02:00
} catch (e) {
console.log(e);
}
},
};