2022-08-09 23:48:33 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js"),
|
2022-08-10 00:37:10 +05:00
|
|
|
Mee6Api = require("../../helpers/mee6-api");
|
2022-08-09 23:48:33 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class ImportMee6 extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../base/Client")} client
|
2022-08-09 23:48:33 +05:00
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("importmee6")
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDescription(client.translate("economy/importmee6:DESCRIPTION"))
|
2024-03-30 12:06:19 +05:00
|
|
|
.setDescriptionLocalizations({
|
|
|
|
uk: client.translate("economy/importmee6:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("economy/importmee6:DESCRIPTION", null, "ru-RU"),
|
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false),
|
2022-08-09 23:48:33 +05:00
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
}
|
2024-02-06 21:45:53 +05:00
|
|
|
|
2022-08-09 23:48:33 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
|
|
*/
|
2024-02-09 23:26:57 +05:00
|
|
|
async execute(client, interaction) {
|
2022-08-10 00:37:10 +05:00
|
|
|
await interaction.deferReply();
|
2022-11-18 16:04:04 +05:00
|
|
|
|
2022-08-10 00:37:10 +05:00
|
|
|
const level = (await Mee6Api.getUserXp(interaction.guildId, interaction.member)).level;
|
2022-08-09 23:48:33 +05:00
|
|
|
|
2024-02-09 23:26:57 +05:00
|
|
|
interaction.data.member.level = level;
|
|
|
|
interaction.data.member.exp = 0;
|
2023-09-25 21:42:43 +05:00
|
|
|
|
2024-02-09 23:26:57 +05:00
|
|
|
await interaction.data.member.save();
|
2022-08-09 23:48:33 +05:00
|
|
|
|
2022-08-10 00:37:10 +05:00
|
|
|
interaction.editReply({
|
|
|
|
content: interaction.translate("owner/debug:SUCCESS_LEVEL", {
|
2023-03-26 18:31:19 +05:00
|
|
|
user: interaction.member.toString(),
|
2022-12-15 21:02:38 +05:00
|
|
|
amount: level,
|
2023-11-04 23:06:51 +05:00
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = ImportMee6;
|