2022-10-26 12:38:28 +02:00
|
|
|
const { EmbedBuilder } = require("discord.js");
|
2021-11-18 18:56:42 +01:00
|
|
|
module.exports = {
|
|
|
|
name: "kick",
|
|
|
|
description: "Kick an user",
|
|
|
|
UserPerms: ["KICK_MEMBERS"],
|
2022-07-02 11:06:48 +02:00
|
|
|
BotPerms: ["KICK_MEMBERS"],
|
2021-11-18 18:56:42 +01:00
|
|
|
usage: "(User) {Reason}",
|
|
|
|
category: "Moderation",
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
type: 6,
|
|
|
|
name: "user",
|
|
|
|
description: "The user you want to kick",
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 3,
|
|
|
|
name: "reason",
|
|
|
|
description: "The reason you want to kick",
|
|
|
|
required: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
run: async (client, interaction, args) => {
|
|
|
|
const target = interaction.guild.members.cache.get(args[0]);
|
|
|
|
let reason = args[1] || "No reason provided";
|
|
|
|
if (target.id === interaction.user.id) {
|
|
|
|
interaction.followUp({ content: "You can't kick yourself" });
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
interaction.member.roles.highest.position < target.roles.highest.position
|
|
|
|
) {
|
|
|
|
interaction.followUp({ content: "You don't have enough hierarchy" });
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
interaction.guild.me.roles.highest.position <
|
|
|
|
target.roles.highest.position
|
|
|
|
) {
|
|
|
|
interaction.followUp({ content: "Bot doesn't have enough hierarchy" });
|
|
|
|
}
|
|
|
|
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
|
|
|
|
try {
|
2022-10-26 12:38:28 +02:00
|
|
|
const embed = new EmbedBuilder()
|
2021-11-18 18:56:42 +01:00
|
|
|
.setTitle("User Kicked")
|
|
|
|
.addField("**Moderator**", interaction.user.tag, true)
|
|
|
|
.addField("**User**", target.user.tag, true)
|
|
|
|
.addField("**Reason**", reason, true)
|
2022-10-26 12:38:28 +02:00
|
|
|
.setFooter({
|
|
|
|
text: `Made by ${client.author}`,
|
|
|
|
iconURL: client.user.displayAvatarURL(),
|
|
|
|
})
|
2021-11-18 18:56:42 +01:00
|
|
|
.setTimestamp()
|
|
|
|
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
|
|
|
|
.setColor(client.color);
|
|
|
|
interaction.followUp({ embeds: [embed] });
|
|
|
|
await target.kick(reason);
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
interaction.followUp({ content: `**Error**: ${e.message}` });
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|