Added kick/ ban commands

This commit is contained in:
Sophia Atkinson 2020-10-05 19:28:22 -07:00 committed by GitHub
parent 9eb2b94763
commit 257f8f28de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 46 additions and 0 deletions

View File

@ -15,6 +15,52 @@ client.on('message', message => {
if (message.content.startsWith(`${prefix}test`))
message.channel.send("This test works")
//Kick
if (message.content.startsWith(`${prefix}kick`)) {
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member
.kick('Optional reason that will display in the audit logs')
.then(() => {
message.reply(`Successfully kicked ${user.tag}`);
})
.catch(err => {
message.reply('I was unable to kick the member');
console.error(err);
});
} else {
message.reply("That user isn't in this guild!");
}
} else {
message.reply("You didn't mention the user to kick!");
}
}
//Kick End
//Ban
if (message.content.startsWith(`${prefix}ban`)) {
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member
.ban('Optional reason that will display in the audit logs')
.then(() => {
message.reply(`Successfully Banned ${user.tag}`);
})
.catch(err => {
message.reply('I was unable to Ban the member');
console.error(err);
});
} else {
message.reply("That user isn't in this guild!");
}
} else {
message.reply("You didn't mention the user to Ban!");
}
}
})