JaBa/commands/Economy/divorce.js

39 lines
896 B
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js");
class Divorce extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "divorce",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["di"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 2000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
if (!data.userData.lover) return message.error("economy/divorce:NOT_MARRIED");
const user = this.client.users.cache.get(data.userData.lover) || await this.client.users.fetch(data.userData.lover);
data.userData.lover = null;
data.userData.save();
2021-12-26 19:29:37 +05:00
const oldLover = await this.client.findOrCreateUser({
id: user.id
});
2021-12-10 21:39:54 +05:00
oldLover.lover = null;
oldLover.save();
2021-12-26 19:29:37 +05:00
message.success("economy/divorce:DIVORCED", {
username: user.username
});
2021-12-10 21:39:54 +05:00
}
};
module.exports = Divorce;