Advertisement
Guest User

CODE

a guest
Apr 22nd, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const { token } = require('./config.json');
  3. var { prefix, logchannel } = require('./config.json');
  4. const client = new Discord.Client();
  5.  
  6. client.once('ready', () => {
  7.     console.log('Bot loaded!');
  8.     console.log('This bot was created by >> A Random Stranger <<#8514');
  9.     console.log('For support join NO');
  10.     client.user.setActivity('SUPPORT: !info', { type: 'PLAYING' });
  11.    
  12. })
  13.  
  14.  
  15. client.on('message', async message => {
  16.  
  17.     if (message.content === `${prefix}ping`) {
  18.         message.channel.send('Pong.');
  19.         console.log(`COMMAND: ${message.member.displayName} issued ping command.`);
  20.     }
  21.  
  22.     else if (message.content === `${prefix}info`) {
  23.         message.channel.send(`This server's name is: ${message.guild.name}
  24. It has ${message.guild.memberCount} total members.
  25. It is running **WastefulBot** by **>> A Random Stranger <<#8514**
  26. For support please join https://discord.gg/DUeGGyC`);
  27.         console.log(`COMMAND: ${message.member.displayName} issued info command.`);
  28.     }
  29.  
  30.     else if (message.content === `${prefix}help`) {
  31.         console.log(`COMMAND: ${message.member.displayName} issued help command.`);
  32.         message.delete();
  33.         message.channel.send('Please check your dm\'s.');
  34.         message.member.send(`__**WastefulBot Help**__
  35. !ping | Pong.
  36. !info | Returns information on the server and how to get support for the bot.
  37. !donate | Get information on how to donate.
  38. !help | Shows this information.
  39. __**Administration Commands**__
  40. (Please note these commands require corresponding permissions)
  41. !kick <@User> <Reason> | Kicks the specified user.
  42. !ban <@User> | Bans the specified user.
  43. __**Management Commands**__
  44. (Please note these commands require corresponding permissions)
  45. !staff | Grants a user staff. (WIP - May not work on most servers.)
  46. `);
  47.     }
  48.  
  49.  
  50.  
  51.     if (message.content === (`${prefix}setlog`)) {
  52.  
  53.         if(message.member.hasPermission("MANAGE_CHANNEL")) {
  54.             message.channel.send('Sorry. This command is currently WIP.');
  55.             console.log(`WARNING: ${message.member.displayName} issued setlog command, this command is WIP and does not work.`);
  56.         }
  57.  
  58.     }
  59.  
  60.  
  61.     if (message.content === (`${prefix}donate`)) {
  62.  
  63.         message.channel.send('You can donate at ``https://www.patreon.com/wasteful_development``');
  64.  
  65.     }
  66.  
  67.  
  68.  
  69.  
  70.     //GOOD ABOVE HERE
  71.  
  72.  
  73.    
  74.  
  75.     else if(message.content.startsWith(`${prefix}kick`)) {
  76.  
  77.         if(message.member.hasPermission("KICK_MEMBERS")) {
  78.  
  79.             if (!message.mentions.users.size) {
  80.                 return message.reply('You must tag 1 user.');
  81.             }
  82.  
  83.             else {
  84.                
  85.                 let member = message.mentions.members.first();
  86.                 let reason = message.content.split(" ").slice(2);
  87.  
  88.                 if(member.kickable == false) {
  89.                     message.channel.send("That user cannot be kicked!");
  90.                     return;
  91.                 }
  92.  
  93.                 else {
  94.  
  95.                    
  96.                     if(reason == ``) {
  97.                         reason = (`No reason provided.`)
  98.                     }
  99.  
  100.  
  101.                     await member.send(`You have been kicked from **${message.guild.name}** with the reason: **${reason}**`)
  102.                     .catch(err => message.channel.send(`⚠ Unable to contact **${member}**.`));
  103.                  
  104.                     await member.kick(reason)
  105.                     await message.channel.send(`👋 ${member} has been kicked for ${reason}`);
  106.                  
  107.                     console.log(`${message.author.tag} kicked ${member.user.tag} from '${message.guild.name}' with the reason '${reason}'.`);
  108.                 }
  109.  
  110.  
  111.             }
  112.  
  113.         }
  114.  
  115.         else {
  116.             message.channel.send("You do not have permission to use kick.");
  117.             return;
  118.         }
  119.  
  120.     }
  121.  
  122. //End of kick mthd
  123.  
  124.  
  125. /*
  126.  
  127.  
  128.                         member.kick(reason).then((member) => {
  129.                             message.channel.send("👋 " + member.displayName + " has been kicked!");
  130.                             console.log(`KICK: ${message.member.displayName} successfully executed kick command.`);
  131.                         });
  132.  
  133.  
  134. */
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144. else if(message.content.startsWith(`${prefix}staff`)) {
  145.  
  146.     if(message.member.hasPermission("MANAGE_ROLES")) {
  147.  
  148.         if (!message.mentions.users.size) {
  149.             return message.reply('You must tag 1 user.');
  150.         }
  151.  
  152.         else {
  153.            
  154.             let member = message.mentions.members.first();
  155.  
  156.            
  157.             member.addRole("569174153337503804");
  158.             message.channel.send(`Granted ${member.displayName} staff!`);
  159.             message.channel.send(`Warning this command will not have worked on most servers as it is WIP.`);
  160.             console.log(`STAFF: ${message.member.displayName} successfully granted ${member.displayName} staff .`);
  161.         }
  162.  
  163.     }
  164.  
  165.     else {
  166.         message.channel.send("**You do not have permission to grant users staff.**");
  167.         return;
  168.     }
  169.  
  170. }
  171.  
  172.  
  173.  
  174.  
  175.  
  176. })
  177.  
  178.  
  179. client.login(token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement