55 lines
2.7 KiB
JavaScript
55 lines
2.7 KiB
JavaScript
const { MessageEmbed } = require("discord.js")
|
|
const moment = require('moment')
|
|
|
|
module.exports = {
|
|
name: "kick",
|
|
category: "moderation",
|
|
description: "einen Benutzer kicken",
|
|
cooldown: 5,
|
|
userPerms: ["KICK_MEMBERS"],
|
|
clientPerms: ["KICK_MEMBERS"],
|
|
run: async(client, message, args) => {
|
|
const mentionedMember = message.mentions.members.first() || message.guild.members.cache.get(args[0])
|
|
const reason = args.slice(1).join(" ")
|
|
if (!args[0]) return message.channel.send(":x: | **Geben Sie jemanden zum Kicken an.**")
|
|
if (!mentionedMember) return message.channel.send(":x: | **Ich kann dieses Mitglied nicht finden.**")
|
|
if (mentionedMember.id === message.author.id) return message.channel.send(":x: | Du kannst dich nicht kicken.")
|
|
if (mentionedMember.roles.highest.position >= message.member.roles.highest.position && message.author.id !== message.guild.owner.id) {
|
|
return message.channel.send(":x: | **Du kannst dieses Mitglied nicht kicken, da deine Rolle niedriger ist als diese Mitgliedsrolle.**")
|
|
}
|
|
if (mentionedMember.kickable) {
|
|
const embed = new MessageEmbed()
|
|
.setAuthor(`${message.author.username} - (${message.author.id})`, message.author.displayAvatarURL({dynamic: true}))
|
|
.setThumbnail(mentionedMember.user.displayAvatarURL({dynamic: true}))
|
|
.setColor(`RANDOM`)
|
|
.setDescription(`
|
|
**Member:** ${mentionedMember.user.username} - (${mentionedMember.user.id})
|
|
**Reason:** ${reason || "None"}
|
|
`)
|
|
message.channel.send(embed)
|
|
mentionedMember.kick()
|
|
} else {
|
|
return message.channel.send(":x: | **Ich kann diesen Benutzer nicht kicken. Stellen Sie sicher, dass die Benutzerrolle niedriger ist als meine Rolle.**")
|
|
}
|
|
return undefined
|
|
let channel = db.fetch(`modlog_${message.guild.id}`)
|
|
if (!channel) return;
|
|
|
|
const embed = new MessageEmbed()
|
|
.setAuthor(`${message.guild.name} Modlogs`, message.guild.iconURL())
|
|
.setColor("#ff0000")
|
|
.setThumbnail(kickMember.user.displayAvatarURL({ dynamic: true }))
|
|
.setFooter(message.guild.name, message.guild.iconURL())
|
|
.addField("**Moderation**", "kick")
|
|
.addField("**User Kicked**", kickMember.user.username)
|
|
.addField("**Kicked By**", message.author.username)
|
|
.addField("**Reason**", `${reason || "**No Reason**"}`)
|
|
.addField("**Date**", message.createdAt.toLocaleString())
|
|
.setTimestamp();
|
|
|
|
var sChannel = message.guild.channels.cache.get(channel)
|
|
if (!sChannel) return;
|
|
sChannel.send(embed)
|
|
}
|
|
}
|