Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', message => {
- if (!message.guild) return;
- if (message.content.startsWith('?ban')) {
- const user = message.mentions.users.first()
- if (user) {
- const member = message.guild.member(user);
- if (member) {
- member.ban({
- reason: 'They were bad!',
- }).then(() => {
- message.reply(`Successfully banned ${user.tag}, LOSER HAH! Get the ban hammer boi!`); // this is the message that will be.
- }).catch(err => {
- message.reply('I was unable to ban the member. Check if their roles are higher then mine or if they have administrative permissions!'); // if a user does not have permission to use a command on a user or as a member, this message will be send.
- //** for my bot I would say message.reply(`${author.tag}, sorry, I was unable to ban this user! Check to see if there roles are above mine, or if this user is an admin!`)**\\
- console.error(err);
- });
- } else {
- message.reply('That user isn\'t in this guild!');
- }
- } else {
- message.reply('You didn\'t mention the user to ban!');
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment