Advertisement
DieselGaming67

Simple Discord Bot

Mar 10th, 2019
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. console.log("Code Starting...")
  2. const token = "botTokenHere";
  3. const prefix = "PrefixHere";
  4.  
  5. console.log("Grabbing modules and bot...")
  6. const Discord = require('discord.js');
  7. const bot = new Discord.Client();
  8.  
  9. bot.once('ready', async => {
  10.     bot.user.setActivity("on the server", {type: "PLAYING"});
  11.     console.log("Ready Event initialised!");
  12.     console.log("Starting bot...");
  13. });
  14.  
  15. // bot.login(token).then(() => console.log("Bot started"));
  16.  
  17. bot.on('message', async (message) => {
  18.  
  19.     if(message.author.bot || message.channel. type === "dm" || !message.content.startsWith(prefix)) return;
  20.  
  21.     const args = message.content.slice(prefix.length).trim().split(/ +/g);
  22.     const command = args.shift().toLowerCase();
  23.  
  24.     if(command === "commandName"){
  25.    
  26.     // Command code here
  27.  
  28.     };
  29.  
  30. });
  31.  
  32. bot.login(token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement