2022-08-09 23:48:33 +05:00
|
|
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Achievements extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("achievements")
|
|
|
|
.setDescription(client.translate("economy/achievements:DESCRIPTION"))
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false)
|
2022-08-09 23:48:33 +05:00
|
|
|
.addUserOption(option => option.setName("user")
|
|
|
|
.setDescription(client.translate("common:USER"))),
|
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
|
|
* @param {Object} data
|
|
|
|
*/
|
|
|
|
async execute(client, interaction, data) {
|
2022-11-18 16:04:04 +05:00
|
|
|
const user = interaction.options.getUser("user") || interaction.member;
|
|
|
|
if (user.bot) return interaction.error("economy/profile:BOT_USER");
|
2023-01-09 01:39:13 +05:00
|
|
|
|
2022-11-18 16:04:04 +05:00
|
|
|
const userData = (user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({
|
2022-12-15 21:02:38 +05:00
|
|
|
id: user.id,
|
2022-08-09 23:48:33 +05:00
|
|
|
}));
|
|
|
|
|
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setAuthor({
|
2022-12-15 21:02:38 +05:00
|
|
|
name: interaction.translate("economy/achievements:TITLE"),
|
2022-08-09 23:48:33 +05:00
|
|
|
})
|
|
|
|
.setColor(client.config.embed.color)
|
|
|
|
.setFooter({
|
2022-12-15 21:02:38 +05:00
|
|
|
text: client.config.embed.footer,
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
|
|
|
|
embed.addFields([
|
|
|
|
{
|
|
|
|
name: interaction.translate("economy/achievements:SEND_CMD"),
|
|
|
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
|
|
|
now: userData.achievements.firstCommand.progress.now,
|
|
|
|
total: userData.achievements.firstCommand.progress.total,
|
2022-12-15 21:02:38 +05:00
|
|
|
percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total)),
|
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("economy/achievements:CLAIM_SALARY"),
|
|
|
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
|
|
|
now: userData.achievements.work.progress.now,
|
|
|
|
total: userData.achievements.work.progress.total,
|
2022-12-15 21:02:38 +05:00
|
|
|
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)),
|
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("economy/achievements:MARRY"),
|
|
|
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
|
|
|
now: userData.achievements.married.progress.now,
|
|
|
|
total: userData.achievements.married.progress.total,
|
2022-12-15 21:02:38 +05:00
|
|
|
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)),
|
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("economy/achievements:SLOTS"),
|
|
|
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
|
|
|
now: userData.achievements.slots.progress.now,
|
|
|
|
total: userData.achievements.slots.progress.total,
|
2022-12-15 21:02:38 +05:00
|
|
|
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)),
|
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("economy/achievements:TIP"),
|
|
|
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
|
|
|
now: userData.achievements.tip.progress.now,
|
|
|
|
total: userData.achievements.tip.progress.total,
|
2022-12-15 21:02:38 +05:00
|
|
|
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)),
|
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("economy/achievements:REP"),
|
|
|
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
|
|
|
now: userData.achievements.rep.progress.now,
|
|
|
|
total: userData.achievements.rep.progress.total,
|
2022-12-15 21:02:38 +05:00
|
|
|
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)),
|
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: interaction.translate("economy/achievements:INVITE"),
|
|
|
|
value: interaction.translate("economy/achievements:PROGRESS", {
|
|
|
|
now: userData.achievements.invite.progress.now,
|
|
|
|
total: userData.achievements.invite.progress.total,
|
2022-12-15 21:02:38 +05:00
|
|
|
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)),
|
|
|
|
}),
|
|
|
|
},
|
2022-08-09 23:48:33 +05:00
|
|
|
]);
|
|
|
|
|
|
|
|
interaction.reply({
|
2022-12-15 21:02:38 +05:00
|
|
|
embeds: [embed],
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Achievements;
|