Facebook
From Jawzii, 3 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 5396
  1. const Discord = require('discord.js');
  2. const embed = require('discord-embed-maker');
  3. const {RichEmbed} = require('discord.js');
  4. const db = require('quick.db');
  5. const fs = require("fs");
  6. const bot = new Discord.Client({disableEveryone: true});
  7. bot.commands = new Discord.Collection();
  8.  
  9.  
  10. fs.readdir("./commands/", (err, file) => {
  11.  
  12.  
  13.  
  14.     if(err) console.log(err);
  15.  
  16.     let jsfile = files.filter(f => f.split(".").pop() === "js");
  17.  
  18.     if(jsfile.length <= 0){
  19.  
  20.       console.log("Couldn't find commands.");
  21.  
  22.       return;
  23.  
  24.     }
  25.  
  26.     jsfile.forEach((f, i) =>{
  27.  
  28.       let props = require(`./commands/${f}`);
  29.  
  30.       console.log(`${f} loaded!`);
  31.  
  32.       bot.commands.set(props.help.name, props);
  33.  
  34.     });
  35.  
  36.   });
  37.  
  38. //Configure Packages
  39. const client = new Discord.Client();
  40. let prefix = '>';
  41.  
  42. bot.on('ready', () =>{
  43. bot.user.setActivity("@ Ngahu's House",)
  44.     type: "STREAMING",
  45.  
  46.     console.log("This bot is now online!")
  47.     }
  48. )
  49. bot.on("message", async message =>{
  50.     if(message.author.bot) return;
  51.     if(message.channel.type === "dm") return;
  52.  
  53.     let messageArray = message.content.split(" ");
  54.     let command = messageArray [0];
  55.     let args = messageArray.slice(1);
  56.     let user = message.mentions.users.first() || message.author;
  57.     console.log(user.roles); // it is undefined
  58.     let commandfile = bot.commands.get(cmd.slice(prefix.length));
  59.     if(commandfile) commandfile.run(bot,message,args);
  60.  
  61.     // PREFIX COMMAND - This requires the quick.db package line 4
  62.     let fetched = await db.fetch(`prefix_${message.guild.id}`);
  63.     if (fetched ===null) prefix = `>`;// If not set, fetched will be `null`
  64.     else prefix = fetched; // Although, if its defined, set fprefix to what we fetched.
  65.  
  66.     if (message.content === 'userinfo') {
  67.         let embed = new Discord.RichEmbed()
  68.             embed.setAuthor(message.author.username)
  69.             embed.setDescription("Information about yourself")
  70.             embed.setColor("#FF00FF")
  71.             embed.addField("Full Username", `${message.author.username}#${message.author.discriminator}`)
  72.             embed.addField("ID", message.author.id)
  73.             embed.addField("Nickname:", `${message.nickname !== null ? `${message.nickname}` : 'None'}`, true)
  74.             embed.addField("Created At", message.author.createdAt)
  75.             embed.addField("You Joined the server at", message.member.joinedAt)
  76.             embed.setFooter("Generated By The Boys Penthouse with data from Discord")
  77.  
  78.  
  79.  
  80.             message.channel.send(embed);
  81.  
  82.             return;
  83.            
  84.             }
  85.         })
  86.     bot.on("message", async message =>{
  87.         if(message.author.bot) return;
  88.         if(message.channel.type === "dm") return;
  89.    
  90.         let messageArray = message.content.split(" ");
  91.         let command = messageArray [0];
  92.         let args = messageArray.slice(1);
  93.    
  94.         if (message.content === 'commands') {
  95.             let embed = new Discord.RichEmbed()
  96.                 embed.setAuthor(message.author.username)
  97.                 embed.setDescription("COMMANDS")
  98.                 embed.setColor("#FF00FF")
  99.                 embed.addField("Full Username", `${message.author.username}#${message.author.discriminator}`)
  100.                 embed.addField("Serverinfo", "If you type serverinfo (All Lowercase) it will show you the server information from the day it was created and who it's created by.")
  101.                 embed.addField("Userinfo", "If you type userinfo (All lowercase) this will show you your user information from the day your account was created due to Discord Database.")
  102.                 embed.addField("Morning and Night", "The Morning and Night comamnd also works from the time you say gn or gm the bot will respond with the custom made command.")
  103.                 embed.addField("More to come soon...", "This is not the end of our command list, there will be more in the future, if you want to suggest more commands and what you want to there to be please dm Jawzii#2734 on discord!")
  104.                
  105.    
  106.                 message.channel.send(embed);
  107.    
  108.                 return;
  109.                
  110.                 }
  111.             });
  112. bot.on("message", async message =>{
  113.     if(message.author.bot) return;
  114.     if(message.channel.type === "dm") return;
  115.  
  116.     let messageArray = message.content.split(" ");
  117.     let command = messageArray [0];
  118.     let args = messageArray.slice(1);
  119.    
  120.     if (message.content === 'serverinfo') {
  121.         let embed = new Discord.RichEmbed()
  122.         embed.setDescription("This is all the Infomation you need to know about our server!")
  123.         embed.addField('Name', `${message.guild.name}`, (`${message.guild.nameAcronym, true}`))
  124.         embed.addField('Server Owner', message.guild.owner.user.tag, true)
  125.         embed.addField("Server Create Date", message.guild.createdAt, true)
  126.         embed.addField("Member Count", message.guild.memberCount, true)
  127.         embed.addField("Channel Count", message.guild.channels.count)
  128.         embed.setColor("#FF00FF")
  129.         embed.setFooter("Generated By The Boys Penthouse with data from Discord")
  130.  
  131.  
  132.             message.channel.send(embed);
  133.  
  134.             return;
  135.            
  136.             }
  137.         });
  138.         bot.on("message", async message =>{
  139.             if(message.author.bot) return;
  140.             if(message.channel.type === "dm") return;
  141.        
  142.             let messageArray = message.content.split(" ");
  143.             let command = messageArray [0];
  144.             let args = messageArray.slice(1);
  145.            
  146.             if (message.content === 'rules') {
  147.                 let embed = new Discord.RichEmbed()
  148.                 embed.addField('Server Owner', message.guild.owner.user.tag, true)
  149.                 embed.setDescription("Server Rules")
  150.                 embed.addField("Number 1" , "- 1.01  No blank nicknames.")
  151.                 embed.addField("Number 2" ,"- 1.02 No inappropriate nicknames.")
  152.                 embed.addField("Number 3" ,"- 1.03 No sexually Explicit Nicknames")
  153.                 embed.addField("Number 4" ,"- 1.04 No inappropriate profile pictures")
  154.                 embed.addField("Number 5" ,"- 1.05 No DMing and Adming... Please use the Help Text chat that is provided below")
  155.                 embed.addField("Number 6" ,"- 1.06 DO NOT USE THE MENTION @Everyone OR @here FOR NO REASON AND NO PERMISSION FROM AN ADMIN!")
  156.                 embed.addField("Number 7" ,"- 1.07 No **ILLIGAL** Content, if so result may end in a perm ban!")
  157.                 embed.addField("Number 8" ,"- 1.08 Trolling/Spamming is prohibited!")
  158.                 embed.addField("Number 9" ,"- 1.09 No **CAP LOCKS**")
  159.                 embed.addField("Number 10" ,"- 1.10 Moderators reserve the right to edit/delete any post you may put here.")
  160.                 embed.addField("Number 11" ,"- 1.11 Any discord links is prohibited, we don't mind if you post your Twitter, YouTube, Twitch link but please once per 1 day otherwise you will be warned...")
  161.                 embed.addField("Number 12" ,"- 1.12 No Channel Hopping")
  162.                 embed.setThumbnail(url="https://i.imgur.com/Ln1T8OT.png")
  163.                 embed.setColor("#FF00FF")
  164.                
  165.        
  166.        
  167.                     message.channel.send(embed);
  168.        
  169.                     return;
  170.                    
  171.                     }
  172.                 });
  173.                 bot.on("message", async message =>{
  174.                     if(message.author.bot) return;
  175.                     if(message.channel.type === "dm") return;
  176.                
  177.                     let messageArray = message.content.split(" ");
  178.                     let command = messageArray [0];
  179.                     let args = messageArray.slice(1);
  180.                    
  181.                     if (message.content === 'vrules') {
  182.                         let embed = new Discord.RichEmbed()
  183.                         embed.setDescription("Voice Chat Rules")
  184.                         embed.addField("Number 13" ,"- 3.01 No Voice Chat Channel Hopping",)
  185.                         embed.addField("Number 14" ,"- 3.02**No annoying, loud or high pitch noises**")
  186.                         embed.addField("Number 15" ,"- 3.03 **PLEASE** use push to talk")
  187.                         embed.addField("Number 16" ,"- 3.04 NO Soundboards!")
  188.                         embed.addField("Number 17" ,"- 3.05 Moderators reserve the right to disconnect/move you from a VC if your sound quality is poor.")
  189.                         embed.addField("Number 18" ,"- 3.06 Moderators reserve the right to mute,deafen or move member to and from voice channel.")
  190.                         embed.setThumbnail(url="https://i.imgur.com/Ln1T8OT.png");
  191.                         embed.setColor("#FF00FF")
  192.                         embed.setFooter("Generated By The Boys Penthouse with data from Discord")
  193.                
  194.                
  195.                             message.channel.send(embed);
  196.                
  197.                             return;
  198.                            
  199.                             }
  200.                         });
  201.  
  202.  
  203. bot.on('message', msg=>{
  204.  
  205.     if(msg.content === "morning"){
  206.  
  207.         msg.reply("Morning")
  208.     }
  209. })
  210. bot.on('message', msg=>{
  211.     if(msg.content == "hello"){
  212.         msg.reply("Hello mate, How are you")
  213.     }
  214. })
  215. bot.on('message', msg=>{
  216.  
  217.     if(msg.content === "Morning"){
  218.  
  219.         msg.reply("Morning")
  220.     }
  221. })
  222. bot.on('message', msg=>{
  223.  
  224.     if(msg.content === "gm"){
  225.  
  226.         msg.reply("Morning")
  227.     }
  228. })
  229. bot.on('message', msg=>{
  230.  
  231.     if(msg.content === "good morning"){
  232.  
  233.         msg.reply("Morning")
  234.     }
  235. })
  236. bot.on('message', msg=>{
  237.  
  238.     if(msg.content === "Good Morning"){
  239.  
  240.         msg.reply("Morning")
  241.     }
  242. })
  243. bot.on('message', msg=>{
  244.  
  245.     if(msg.content === "Good Night"){
  246.  
  247.         msg.reply("Good Night Mate")
  248.     }
  249. })
  250. bot.on('message', msg=>{
  251.  
  252.     if(msg.content === "Good night"){
  253.  
  254.         msg.reply("Good Night Mate")
  255.     }
  256. })
  257. bot.on('message', msg=>{
  258.  
  259.     if(msg.content === "good night"){
  260.  
  261.         msg.reply("Good Night Mate")
  262.     }
  263. })
  264. bot.on('message', msg=>{
  265.  
  266.     if(msg.content === "gn"){
  267.  
  268.         msg.reply("Good Night Mate")
  269.     }
  270. })
  271. bot.on('message', msg=>{
  272.  
  273.     if(msg.content === "Good morning"){
  274.  
  275.         msg.reply("Morning")
  276.     }
  277. })
  278.  
  279. bot.login(token);

Replies to Bot code rss

Title Name Language When
Re: Bot code Chartreuse Flamingo javascript 5 Months ago.
Re: Bot code Bitty Leech javascript 6 Months ago.
Re: Bot code Venturion cpp 10 Months ago.
Re: Bot code Soft Hedgehog python 1 Year ago.
Re: Bot code https://pastebin.com/MKXcP6LN javascript 1 Year ago.