Guest User

Simple Discord Bot

a guest
Mar 26th, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. /*
  2. Simple Discord Bot
  3. By thepcgeek
  4.  
  5. https://www.instructables.com/id/How-to-Make-a-Discord-Bot-Using-NodeJS/
  6. */
  7. const Discord = require("discord.js");
  8. const client = new Discord.Client();
  9.  
  10. client.on("ready", ()=> {
  11. console.log("Superbot 3000 has initialized!");
  12. console.log("==User Information==");
  13. console.log(`Username: ${client.user.tag}`);
  14. });
  15.  
  16. client.on("message", (message)=> {
  17. if(message.author.bot) return;
  18. var prefix = "sup";
  19. if(message.content.startsWith(prefix + " "))
  20. {
  21. //The command
  22. var commandSplit = message.content.split(" ");
  23. var command = commandSplit[1];
  24.  
  25. //A simple switch
  26. switch(command)
  27. {
  28. case "hello":
  29. message.channel.send("Hello there!");
  30. break;
  31. }
  32. }
  33. });
  34.  
  35. client.login("put your token here");
Advertisement
Add Comment
Please, Sign In to add comment