2023-07-03 21:13:08 +05:00
|
|
|
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
|
2022-08-06 20:47:47 +05:00
|
|
|
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"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.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"),
|
2023-06-15 19:46:27 +05:00
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.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),
|
|
|
|
),
|
2022-08-06 20:47:47 +05:00
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-06 20:47:47 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @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
|
2022-08-06 20:47:47 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
|
|
|
const member = interaction.options.getMember("user");
|
|
|
|
|
|
|
|
const memberData = await client.findOrCreateMember({
|
|
|
|
id: member.id,
|
2022-12-15 21:02:38 +05:00
|
|
|
guildId: interaction.guildId,
|
2022-08-06 20:47:47 +05:00
|
|
|
});
|
|
|
|
|
|
|
|
memberData.sanctions = [];
|
2023-09-25 21:42:43 +05:00
|
|
|
|
2023-10-30 21:45:10 +05:00
|
|
|
memberData.markModified("sanctions");
|
2023-10-17 08:33:41 +05:00
|
|
|
await memberData.save();
|
2023-01-09 01:39:13 +05:00
|
|
|
|
2022-08-06 20:47:47 +05:00
|
|
|
interaction.success("moderation/clearwarns:SUCCESS", {
|
2023-03-19 22:15:16 +05:00
|
|
|
user: member.toString(),
|
2022-08-06 20:47:47 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Clearwarns;
|