Facebook
From Jawzii, 4 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 216
  1. const Discord = require('discord.js');
  2. const embed = require('discord-embed-maker');
  3. const {RichEmbed} = require('discord.js');
  4.  
  5. const bot = new Discord.Client({disableEveryone: true});
  6.  
  7. const token = "TOKEN";
  8.  
  9. bot.on("ready", async () => {
  10.     console.log(${bot.user.username} IS ONLINE!!)
  11.     bot.user.setActivity("@ Ngahu's House", {type: "STREAMING"});
  12. })
  13.  
  14. const fs = require("fs");
  15. bot.commands = new Discord.Collection();
  16. bot.aliases = new Discord.Collection();
  17.  
  18. fs.readdir("./commands/", (err, files) => {
  19.  
  20.     if(err) console.log(err)
  21. 1
  22.     let jsfile = files.filter(f => f.split(".").pop() === "js")
  23.     if(jsfile.length <= 0) {
  24.        return console.kig("[LOGS] Couldn't Find Commands!");
  25.     }
  26.  
  27.     jsfile.forEach((f, i) => {
  28.         let pull = require(./commands/${f});
  29.         bot.commands.set(pull.config.name, pull);
  30.         pull.config.aliases.forEach(alias => {
  31.             bot.aliases.set(alias, pull.config.name)
  32.         });
  33.     });
  34. });
  35.  
  36. bot.on("message", async message =>{
  37.     if(message.author.bot) return;
  38.     if(message.channel.type === "dm") return;
  39.  
  40.  
  41.     let messageArray = message.content.split(" ");
  42.     let command = messageArray [0];
  43.     let args = messageArray.slice(1);
  44.     let cmd = messageArray[0];
  45.     let user = message.mentions.users.first()  message.author;
  46.     console.log(user.roles); // it is undefined
  47.  
  48.     let commandfile = bot.commands.get(cmd.slice(prefix.length))  bot.command.get(bot.aliases.get(cmd.slice (prefix.length)))
  49.     if(commandfile) commandfile.run(bot,message,args)
  50. if (message.content === 'userinfo') {
  51.         let embed = new Discord.RichEmbed()
  52.             embed.setAuthor(message.author.username)
  53.             embed.setDescription("Information about yourself")
  54.             embed.setColor("#FF00FF")
  55.             embed.addField("Full Username", ${message.author.username}#${message.author.discriminator})
  56.             embed.addField("ID", message.author.id)
  57.             embed.addField("Created At", message.author.createdAt)
  58.             embed.setThumbnail(url="https://i.imgur.com/YjUfJKZ.png%22%22);
  59.            embed.setFooter("Generated By The Boys Penthouse with data from Discord", "https://i.imgur.com/YjUfJKZ.png%22%22)
  60.  
  61.  
  62.  
  63.             message.channel.send(embed);
  64.  
  65.             return;
  66.  
  67.             }
  68.         })
  69. bot.login(token)