Advertisement
jensie1996

Discord bot tut 1 v12

Apr 18th, 2020
7,156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const discord = require("discord.js");
  2. const botConfig = require("./botconfig.json");
  3.  
  4. const client = new discord.Client();
  5. client.login(botConfig.token);
  6.  
  7. client.on("ready", async () => {
  8.  
  9.     console.log(`${client.user.username} is online.`);
  10.  
  11.     client.user.setActivity("Testing", { type: "PLAYING" });
  12.  
  13. });
  14.  
  15.  
  16. client.on("message", async message => {
  17.  
  18.     if(message.author.bot) return;
  19.  
  20.     if(message.channel.type === "dm") return;
  21.  
  22.     var prefix = botConfig.prefix;
  23.  
  24.     var messageArray = message.content.split(" ");
  25.  
  26.     var command = messageArray[0];
  27.  
  28.     if (command === `${prefix}hallo`) {
  29.  
  30.         return message.channel.send("Hallo!!");
  31.    
  32.     }
  33.  
  34. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement