2022-08-09 23:48:33 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js");
|
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Divorce extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("divorce")
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDescription(client.translate("economy/divorce:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
2023-07-05 00:58:06 +05:00
|
|
|
uk: client.translate("economy/divorce:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"),
|
2023-06-15 19:46:27 +05:00
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false),
|
2022-08-09 23:48:33 +05:00
|
|
|
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) {
|
|
|
|
if (!data.userData.lover) return interaction.error("economy/divorce:NOT_MARRIED");
|
2023-07-05 00:58:06 +05:00
|
|
|
const user = client.users.cache.get(data.userData.lover) || (await client.users.fetch(data.userData.lover));
|
2022-08-09 23:48:33 +05:00
|
|
|
|
|
|
|
data.userData.lover = null;
|
2023-09-25 21:42:43 +05:00
|
|
|
|
2022-08-09 23:48:33 +05:00
|
|
|
await data.userData.save();
|
|
|
|
|
|
|
|
const oldLover = await client.findOrCreateUser({
|
2022-12-15 21:02:38 +05:00
|
|
|
id: user.id,
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
oldLover.lover = null;
|
2023-09-25 21:42:43 +05:00
|
|
|
|
2022-08-09 23:48:33 +05:00
|
|
|
await oldLover.save();
|
|
|
|
|
|
|
|
interaction.success("economy/divorce:DIVORCED", {
|
2022-12-15 21:02:38 +05:00
|
|
|
user: user.toString(),
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
|
|
|
|
user.send({
|
|
|
|
content: interaction.translate("economy/divorce:DIVORCED_U", {
|
2022-12-15 21:02:38 +05:00
|
|
|
user: interaction.member.toString(),
|
|
|
|
}),
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Divorce;
|