f
This commit is contained in:
1 parent
a27bfb63e8
commit
670512944c
15 files changed
+33568
-43
No files matched your search
@@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
|
||||
const { time } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'ban',
|
||||
description: `ban a user from the current server`,
|
||||
aliases: ['banish'],
|
||||
usage: 'ban <user> [reason] [duration]',
|
||||
|
||||
async execute(client, message, args) {
|
||||
if (!message.member.permissions.has('BanMembers')) {
|
||||
return message.reply({
|
||||
content: null, embeds: [{
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
name: message.author.username,
|
||||
icon_url: message.author.displayAvatarURL(),
|
||||
},
|
||||
description: '<:no:1481811955592466492> you do not have permission to use this command!',
|
||||
footer: {
|
||||
text: `twitter @ ${message.guild.name}`,
|
||||
icon_url: client.user.displayAvatarURL(),
|
||||
},
|
||||
timestamp: new Date(),
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
const user = message.mentions.users.first() || client.users.cache.get(args[0]);
|
||||
if (!user) {
|
||||
return message.reply({
|
||||
content: null, embeds: [{
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
name: message.author.username,
|
||||
icon_url: message.author.displayAvatarURL(),
|
||||
},
|
||||
description: '<:no:1481811955592466492> please specify a user to ban!',
|
||||
footer: {
|
||||
text: `twitter @ ${message.guild.name}`,
|
||||
icon_url: client.user.displayAvatarURL(),
|
||||
},
|
||||
timestamp: new Date(),
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
const reason = args.slice(1).join(' ') || 'no reason provided (twitter)';
|
||||
const duration = args[2] ? parseInt(args[2]) : null;
|
||||
|
||||
try {
|
||||
await message.guild.members.ban(user, { reason });
|
||||
message.reply({
|
||||
content: null, embeds: [{
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
name: message.author.username,
|
||||
icon_url: message.author.displayAvatarURL(),
|
||||
},
|
||||
description: `<:check:1481811973447356496> ${user.username} has been banned!`,
|
||||
footer: {
|
||||
text: `twitter @ ${message.guild.name}`,
|
||||
icon_url: client.user.displayAvatarURL(),
|
||||
},
|
||||
timestamp: new Date(),
|
||||
}]
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
message.reply({
|
||||
content: null, embeds: [{
|
||||
color: 0x8aa2b3,
|
||||
author: {
|
||||
name: message.author.username,
|
||||
icon_url: message.author.displayAvatarURL(),
|
||||
},
|
||||
description: '<:no:1481811955592466492> an error occurred while trying to ban the user!',
|
||||
footer: {
|
||||
text: `twitter @ ${message.guild.name}`,
|
||||
icon_url: client.user.displayAvatarURL(),
|
||||
},
|
||||
timestamp: new Date(),
|
||||
}]
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user