Advertisement
Guest User

Untitled

a guest
Sep 5th, 2018
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Commando = require("discord.js-commando")
  2. const Discord = require("discord.js")
  3. const bot = new Commando.Client();
  4. const token = "NDg0MDY3MDU0NTcyMjczNjY0.Dmj4WA.IMLxWsPw6e5In6bu0q22bVQj0i0";
  5. const botconfig = require("./botconfig.json");
  6. const economy = require("discord-eco")
  7. const dba = require('discord-dba');
  8. const fs = require("fs");
  9. let prefix2 = '^';
  10. bot.commands = new Discord.Collection();
  11. bot.on('message', message => {
  12.     if(message.content.startsWith("Unknown command.")) {
  13.         message.delete(100);
  14.         message.channel.send(message.content.slice(5, message.content.length));
  15.     }
  16. });
  17. fs.readdir("./cmds/", (err, files) => {
  18.     if(err) console.log(err);
  19.     let jsfile = files.filter(f => f.split(".").pop() === "js")
  20.     if(jsfile.length <= 0){
  21.         console.log("Couldn't find commands.");
  22.         return;
  23.     }
  24.  
  25.     jsfile.forEach((f, i) =>{
  26.         let props = require(`./cmds/${f}`);
  27.         console.log(`${f} loaded!`);
  28.         bot.commands.set(props.help.name, props)
  29.     });
  30.  
  31. });
  32. const mysql = require('mysql');
  33. const express = require('express')
  34. const Client = require('fortnite')
  35. const fortnite = new Client("aaed04ee-dec9-4b32-bfce-0fca0cbf7f34");
  36. var app = express();
  37. var connection = mysql.createConnection({
  38.     host: 'localhost',
  39.     user: 'root',
  40.     password: '',
  41.     database: 'sampleDB'
  42. });
  43. let coins = require("./commands/economy/coins.json");
  44. bot.registry.registerGroup('simple', 'Simple');
  45. bot.registry.registerGroup('music', 'music');
  46. bot.registry.registerGroup('economy', 'economy');
  47. bot.registry.registerCommandsIn(__dirname + '/commands');
  48. bot.registry.registerDefaults();
  49. bot.on("message", function(message){
  50. let messageArray = message.content.split(" ");
  51. msg = message.content.toLowerCase();
  52. let cmd = messageArray[0];
  53. let args = messageArray.slice(1);
  54. let commandfile = bot.commands.get(cmd.slice(prefix2.length));
  55. if(commandfile) commandfile.run(bot,message,args);
  56.  
  57.  
  58. if(message.content == "hello"){
  59. message.channel.sendMessage("Hello!" + message.author +  ",how are you?")
  60. }
  61.  
  62. if (message.content.startsWith("krabby patty")) {
  63.     message.channel.send("PREPARING THE KRABBY PATTY!", {files: ["./images/patty.png"]});
  64.     return;
  65.     }
  66. if (message.content === "ping"){
  67.     message.channel.send("Pong!");
  68.     return;
  69. }
  70. if (message.content === "what do i look like") {
  71.     message.channel.send(message.author.avatarURL);
  72.     message.channel.send("Also UGLY As Fuck");
  73.     return;
  74. }
  75.  
  76. //Test Economy
  77. if (message.content === "payday") {
  78.     economy.updateBalance(message.author.id, 500).then((i) => {
  79.         message.channel.send(`**You got $500**\n**New Balance:** ${i.money}`);
  80.     })
  81. }
  82. if (message.content === "balance") {
  83.  
  84.     economy.fetchBalance(message.author.id).then((i) => { // economy.fetchBalance grabs the userID, finds it, and puts it into 'i'.
  85.         message.channel.send(`**Balance:** ${i.money}`);
  86.     })
  87.  
  88.  
  89. }
  90. if (message.content === "payfine") {
  91.  
  92.     economy.updateBalance(message.author.id, -500).then((i) => { // Since the 'value' is -500, it will 'add' -500, making the balance $500 lower.
  93.         message.channel.send(`**You paid your fine of $500!**\n**New Balance:** ${i.money}`);
  94.     })
  95.  
  96. }
  97. if (message.content === "meme")/*if you want to start with the prefix just do if (message.startsWith (prefix + "meme"))*/ {
  98.     number = 302;
  99.     imageNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
  100.     message.channel.send ({files: ["./images/memes/" + imageNumber + ".png"]})
  101. }
  102. if (message.content === "SALbotinfo"){
  103.     let bicon = bot.user.displayAvatarURL;
  104.     let botembed = new Discord.RichEmbed()
  105.     .setDescription("Bot Information")
  106.     .setColor("#51ff77")
  107.     .setThumbnail(bicon)
  108.     .addField("Bot Name", bot.user.username)
  109.     .addField("Created On", bot.user.createdAt);
  110. return message.channel.send(botembed);
  111. }
  112.  
  113. if (message.content === "SALserverinfo"){
  114.     let sicon = message.guild.iconURL;
  115.     let serverembed = new Discord.RichEmbed()
  116.     .setDescription("Server Information")
  117.     .setColor("#51ffff")
  118.     .setThumbnail(sicon)
  119.     .addField("Server Name", message.guild.name)
  120.     .addField("Created On", message.guild.createdAt)
  121.     .addField("You Joined", message.member.joinedAt)
  122.     .addField("Total Members", message.guild.memberCount);
  123.     return message.channel.send(serverembed);
  124. }
  125. if(message.content.startsWith(`SALreport`)){
  126.     let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  127.     if(!rUser) return message.channel.send("Couldn't find user.");
  128.     let reason = args.join(" ").slice(22);
  129.     let reportEmbed = new Discord.RichEmbed()
  130.     .setDescription("Reports")
  131.     .setColor("#15f")
  132.     .addField("Reported User", `${rUser} with ID: ${rUser.id}`)
  133.     .addField("Reported By", `${message.author} with ID: ${message.author.id}`)
  134.     .addField("Channel", message.channel)
  135.     .addField("Time", message.createdAt)
  136.     .addField("Reason", reason);
  137.     let reportschannel = bot.channels.find('name', "reports");
  138.     if(!reportschannel) return message.channel.send("Couldn't find reports channel.");
  139.     message.delete().catch(O_o=>{});
  140.     reportschannel.send(reportEmbed);
  141.  
  142. }
  143. if(message.content.startsWith(`SALkick`)){
  144.     let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  145.     if(!kUser) return message.channel.send("Can't find user!");
  146.     let kReason= args.join(" ").slice(22);
  147.     if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("No can do pal!");
  148.     if(kUser.hasPermission("KICK_MEMBERS")) return message.channel.send("That person can't be kicked");
  149.  
  150.     let kickEmbed = new Discord.RichEmbed()
  151.     .setDescription("~Kick~")
  152.     .setColor("#f7e202")
  153.     .addField("Kicked User", `${kUser} with ID ${kUser.id}`)
  154.     .addField("Kicked By", `<@${message.author.id}> with ID ${message.author.id}`)
  155.     .addField("Kicked In", message.channel)
  156.     .addField("Time", message.createdAt)
  157.     .addField("Reason", kReason);
  158.  
  159.     let kickChannel = bot.channels.find('name', "kicks-and-bans");
  160.     if(!kickChannel) return message.channel.send("Can't find kick channel.");
  161.  
  162.     message.guild.member(kUser).kick(kReason);
  163.     kickChannel.send(kickEmbed);
  164. }
  165. if(message.content.startsWith(`SALban`)){
  166.     let bUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  167.     if(!bUser) return message.channel.send("Can't find user!");
  168.     let bReason= args.join(" ").slice(22);
  169.     if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("No can do pal!");
  170.     if(bUser.hasPermission("KICK_MEMBERS")) return message.channel.send("That person can't be Banned");
  171.  
  172.     let banEmbed = new Discord.RichEmbed()
  173.     .setDescription("~Ban~")
  174.     .setColor("#f442d4")
  175.     .addField("Ban User", `${bUser} with ID ${bUser.id}`)
  176.     .addField("Banned By", `<@${message.author.id}> with ID ${message.author.id}`)
  177.     .addField("Banned In", message.channel)
  178.     .addField("Time", message.createdAt)
  179.     .addField("Reason", bReason);
  180.  
  181.     let kickChannel = bot.channels.find('name', "kicks-and-bans");
  182.     if(!kickChannel) return message.channel.send("Can't find kick channel.");
  183.  
  184.     message.guild.member(bUser).ban(bReason);
  185.     kickChannel.send(banEmbed);
  186. }
  187. if (message.channel.id === "486746838352003075") {
  188.     if(isNaN(message.content)) {
  189.         message.delete()
  190.         message.author.send("No messaging in that channel!")
  191.     }
  192. }
  193. if (message.channel.id === "486921615087763457") {
  194.     if(isNaN(message.content)) {
  195.         message.delete()
  196.         message.author.send("No messaging in that channel!")
  197.     }
  198. }
  199. if(message.content.toLowerCase() == "ligma") {
  200.     message.delete()
  201.     message.reply("hey! That word isn’t allowed here!")
  202.    }
  203. });
  204. bot.on("ready", function(){
  205.     console.log(`
  206.     READY!
  207.    
  208.   /$$$$$$   /$$$$$$  /$$       /$$                                     /$$     /$$$$$$$              /$$    
  209.   /$$__  $$ /$$__  $$| $$      | $$                                    | $$    | $$__  $$            | $$    
  210.  | $$  \__/| $$  \ $$| $$     /$$$$$$   /$$   /$$  /$$$$$$   /$$$$$$  /$$$$$$  | $$  \ $$  /$$$$$$  /$$$$$$  
  211.  |  $$$$$$ | $$$$$$$$| $$    |_  $$_/  | $$  | $$ /$$__  $$ /$$__  $$|_  $$_/  | $$$$$$$  /$$__  $$|_  $$_/  
  212.   \____  $$| $$__  $$| $$      | $$    | $$  | $$| $$$$$$$$| $$$$$$$$  | $$    | $$__  $$| $$  \ $$  | $$    
  213.   /$$  \ $$| $$  | $$| $$      | $$ /$$| $$  | $$| $$_____/| $$_____/  | $$ /$$| $$  \ $$| $$  | $$  | $$ /$$
  214.  |  $$$$$$/| $$  | $$| $$$$$$$$|  $$$$/|  $$$$$$$|  $$$$$$$|  $$$$$$$  |  $$$$/| $$$$$$$/|  $$$$$$/  |  $$$$/
  215.   \______/ |__/  |__/|________/ \___/   \____  $$ \_______/ \_______/   \___/  |_______/  \______/    \___/  
  216.                                         /$$  | $$                                                            
  217.                                        |  $$$$$$/                                                            
  218.                                         \______/                                                            
  219.  `)
  220. });
  221.  
  222.  
  223. bot.login(token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement