Advertisement
dfhfjjfgjfsfeedgf

Untitled

Dec 16th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const Config = require("./config.json");
  3. const Token = require("./token.json");
  4. const fs = require("fs");
  5. const superagent = require("superagent");
  6. let config = require("./config.json")
  7.  
  8.  
  9. const bot = new Discord.Client();
  10. bot.commands = new Discord.Collection();
  11.  
  12. fs.readdir("./commands/", (err, files) =>{
  13. if(err) console.log(err);
  14. let jsfile = files.filter(f => f.split(".").pop() === "js");
  15. if(jsfile.length <= 0 ){
  16. console.log("Could not find the command");
  17. return;
  18. }
  19.  
  20. jsfile.forEach((f, i) =>{
  21. let props = require(`./commands/${f}`);
  22. console.log(`${f} has loaded and is now working!`);
  23. bot.commands.set(props.help.name, props);
  24. });
  25. });
  26. //${bot.guilds.size} servers!
  27. bot.on("ready", async () =>{
  28. console.log (`${bot.user.username} is online! It's running on ${bot.guilds.size} servers!`);
  29. //bot.user.setActivity(`S2help`, {type:"PLAYING"});
  30. })
  31.  
  32. //start of joins
  33. bot.on("guildMemberAdd", async member => {
  34. // send a dm
  35. member.send("Hey there! My name is ***Staffy 2.0*** i am a Discord bot specified for ***Staffy's Suppport Server*** If you need help just do `S2help` and i will PM/DM you a list of commands :) Make sure to read our rules!!");
  36. });
  37. //end of joins
  38.  
  39.  
  40. bot.on("message", async message => {
  41.  
  42. if(message.author.bot) return;
  43. if(message.channel.type === "dm") return;
  44.  
  45. let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"));
  46. if(!prefixes[message.guild.id]){
  47. prefixes[message.guild.id] = {
  48. prefixes: config.prefix
  49. };
  50. }
  51. let prefix = prefixes[message.guild.id].prefixes;
  52. if(!message.content.startsWith(prefix)) return;
  53. let messageArray = message.content.split(" ");
  54. let cmd = messageArray[0];
  55. let args = messageArray.slice(1);
  56.  
  57. let commandfile = bot.commands.get(cmd.slice(prefix.length));
  58. if(commandfile) commandfile.run(bot, message, args);
  59.  
  60. //start of auto changing status boi
  61. function changing_status() {
  62. let status = ['Prefix: l. | l.help', 'Developed by Dond~#3473', 'I\'m Luci', 'Mention me!', 'With my myki\'s']
  63. let random = status[Math.floor(Math.random() * status.length)]
  64. bot.user.setActivity(random, {type: 'PLAYING'});
  65. }
  66. setInterval(changing_status, 5000);
  67. console.log(err)
  68. //end of auto changing status boi
  69.  
  70.  
  71.  
  72. })
  73.  
  74.  
  75.  
  76. bot.login(Token.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement