Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. //https://discordapp.com/oauth2/authorize?client_id=458811785508552714&scope=bot&permissions=3533888
  2. const Discord = require("discord.js");
  3. const config = require("./config.json");
  4. const bot = new Discord.Client();
  5.  
  6. bot.on("ready", function(){
  7. console.log("SlaveBot is ready for commands!");
  8. bot.user.setActivity('in the cotton field - !help');
  9. });
  10.  
  11.  
  12. bot.on("guildCreate", guild => {
  13. $channel = guild.channels.find(m => m.permissionsFor(guild.me).has('SEND_MESSAGES'));
  14. if($channel){
  15. message.channel.send('helllooooo');
  16. }
  17. console.log(`I've joined the guild ${guild.name} (${guild.id}), owned by ${guild.owner.user.username} (${guild.owner.user.id}).`);
  18. });
  19.  
  20. bot.on("message", function(message){
  21. if(message.author.equals(bot.user)) return;
  22.  
  23. if(!message.content.startsWith(PREFIX)) return;
  24.  
  25. var args = message.content.substring(config.prefix.length).split(" ");
  26.  
  27. switch(args[0].toLowerCase()){
  28. case "ping":
  29. message.channel.send("Pong!");
  30. break;
  31. default:
  32. message.channel.send(":x: Invalid command!");
  33. }
  34. });
  35.  
  36. bot.login(config.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement