Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- const config = require("./config.json");
- client.on('ready', () => {
- console.log('I am ready!');
- }); //This is sending a message to the terminal to show the bot is online and working.
- client.on('message', message => {
- if (!message.guild) return;
- if (message.content.startsWith('?kick')) { //**This is the command, this says if someone says ?kick then pay attention to teh rest to teh bot.**\\
- const user = message.mentions.users.first(); // This says if you mention this user, it is talking about that user
- 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}, you should feel bad! They will never be able to rejoin until they click join again!`);
- }).catch(err => {
- message.reply('I was unable to kick the member. Check if their roles are higher then mine or if they have administrative permissions!');
- console.error(err);
- });
- } else {
- message.reply('That user isn\'t in this guild!');
- }
- } else {
- message.reply('You didn\'t mention the user to kick!'); // Thus is creating a message so that you know if you failed
- // The / is to show the script that the (') is not the end of it
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement