Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions commands/Moderation/kick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const discord = require('discord.js');

module.exports = {
name: 'kick',
description: 'Kick an user from server',
aliases: [],
run: async (client, message, args, prefix, config) => {

if (!message.member.hasPermission('KICK_MEMBERS')) { //if the user dont have kick members permission

return message.reply('Sorry, you dont have **kick members** permission...');

}

let user = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(u => u.user.tag === args[0]);

if (!user) { //if no user

return message.reply('Please mention a user');

}

if (!user.kickable) { //if the bot cant kick the user

return message.reply("I can't kick this user, sorry");

}

if (user.id === message.author.id) {

return message.reply("I can't kick you lmao"); //if the user is the message author

}

let reason = args.slice(1).join(' ');

if (!reason) {
reason = 'No reason' //if no reason
}

let embed = new discord.MessageEmbed()
.setColor(config.defaultColor)
.setAuthor('Member sucessfully kicked!', user.user.displayAvatarURL())
.addField('Reason', reason, true)
.addField('Moderator', message.author.tag, true)
.setTimestamp();

let userEmbed = new discord.MessageEmbed()
.setColor('RED')
.setAuthor('Kick')
.addField('Server', message.guild.name, true)
.addField('Moderator', message.author.tag, true)
.addField('Reason', reason, true);

let errEmbed = new discord.MessageEmbed()
.setColor('RED')
.setAuthor('Something Wrong');

user.send(userEmbed).catch(e => console.log(e)); //if user's dm is locked

let msg = await message.channel.send(embed);

user.kick(`By: ${message.author.tag} | Reason: ${reason}`).catch(e => { msg.edit('', errEmbed.setDescription(`Error: ${e}`)) });

}
}
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"token": "bot token",
"defaultPrefix": "bot prefix",
"token": "NzU0OTU5NzMwMzEyNDc4NzUw.X18VCg.iokSQh4SeYDmdfEW5IX5cpdvXtw",
"defaultPrefix": "!",
"defaultColor": "#0000ff"
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ client.on("message", async message => {

if (!message.member) message.member = await message.guild.fetchMember(message); //bug bruuuh

let args = message.content.slice(prefix.length).trim().split(/ +/g); //the args IF YOU HAVE A ERROR GO TO github.com/AngeloCore/src-bot AND COPY THE FILES
let args = message.content.slice(prefix.length).trim().split(/ +/g); //the args IF YOU HAVE A ERROR GO TO GLITCH.COM/~SRC-TESTER AND COPY THE FILES

let cmd = args.shift().toLowerCase(); //the cmd

Expand Down
117 changes: 117 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.