mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-29 00:24:58 +05:00
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
|
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")
|
||
|
.setDescription(client.translate("economy/divorce:DESCRIPTION")),
|
||
|
aliases: [],
|
||
|
dirname: __dirname,
|
||
|
guildOnly: true,
|
||
|
ownerOnly: false
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @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");
|
||
|
const user = client.users.cache.get(data.userData.lover) || await client.users.fetch(data.userData.lover);
|
||
|
|
||
|
data.userData.lover = null;
|
||
|
await data.userData.save();
|
||
|
|
||
|
const oldLover = await client.findOrCreateUser({
|
||
|
id: user.id
|
||
|
});
|
||
|
oldLover.lover = null;
|
||
|
await oldLover.save();
|
||
|
|
||
|
interaction.success("economy/divorce:DIVORCED", {
|
||
|
user: user.toString()
|
||
|
});
|
||
|
|
||
|
user.send({
|
||
|
content: interaction.translate("economy/divorce:DIVORCED_U", {
|
||
|
user: interaction.member.toString()
|
||
|
})
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = Divorce;
|