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 {
|
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-06 20:47:47 +05:00
|
|
|
*/
|
|
|
|
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
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-06 20:47:47 +05:00
|
|
|
});
|
|
|
|
}
|
2024-02-06 21:45:53 +05:00
|
|
|
|
2022-08-06 20:47:47 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-06 20:47:47 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
|
|
|
const member = interaction.options.getMember("user");
|
2024-07-18 00:07:24 +05:00
|
|
|
if (member.user.id === interaction.user.id) return interaction.error("misc:CANT_YOURSELF");
|
2022-08-06 20:47:47 +05:00
|
|
|
|
2024-05-24 23:11:03 +05:00
|
|
|
const memberData = await client.getMemberData(member.id, interaction.guildId);
|
2022-08-06 20:47:47 +05:00
|
|
|
|
|
|
|
memberData.sanctions = [];
|
2023-09-25 21:42:43 +05:00
|
|
|
|
2024-05-29 19:08:26 +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;
|