JaBa/commands/Moderation/clearwarns.js

68 lines
1.7 KiB
JavaScript
Raw Normal View History

2023-07-03 21:13:08 +05:00
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Clearwarns extends BaseCommand {
/**
*
* @param {import("../../base/JaBa")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("clearwarns")
.setDescription(client.translate("moderation/clearwarns:DESCRIPTION"))
.setDescriptionLocalizations({
2023-07-05 00:58:06 +05:00
uk: client.translate("moderation/clearwarns:DESCRIPTION", null, "uk-UA"),
ru: client.translate("moderation/clearwarns:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
2023-07-03 21:13:08 +05:00
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
2023-07-05 00:58:06 +05:00
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({
uk: client.translate("common:USER", null, "uk-UA"),
ru: client.translate("common:USER", null, "ru-RU"),
})
.setRequired(true),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
* @param {import("../../base/JaBa")} client
*/
async onLoad() {
//...
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
2022-08-09 23:48:33 +05:00
* @param {Object} data
*/
async execute(client, interaction) {
const member = interaction.options.getMember("user");
const memberData = await client.findOrCreateMember({
id: member.id,
guildId: interaction.guildId,
});
memberData.sanctions = [];
2023-07-03 19:30:47 +05:00
memberData.markModified("sanctions");
2023-10-17 08:33:41 +05:00
await memberData.save();
interaction.success("moderation/clearwarns:SUCCESS", {
2023-03-19 22:15:16 +05:00
user: member.toString(),
});
}
}
2023-07-05 00:58:06 +05:00
module.exports = Clearwarns;