Advertisement
Guest User

bot

a guest
Feb 20th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. const { Client } = require("discord.js");
  2. const { config } = require("dotenv");
  3.  
  4. const client = new Client({
  5. disableEveryone: true
  6. });
  7.  
  8. config({
  9. path: __dirname + "/.env"
  10. })
  11.  
  12. client.on("ready", () => {
  13. console.log(`I am now online, my name is ${client.user.username}`);
  14.  
  15. client.user.setPresence({
  16. status: "online",
  17. game: {
  18. name: "me getting developed",
  19. type: "WATCHING"
  20. }
  21. })
  22. });
  23.  
  24. client.on("message", async message => {
  25. const prefix = ".";
  26.  
  27. if (!message.author.bot) return;
  28. if (!message.guild) return;
  29. if (!message.content.startsWith(prefix)) return;
  30.  
  31. const args = message.content.slice(prefix.length).trim().split(/ +/g);
  32. const cmd = args.shift().toLowerCase();
  33.  
  34. if (cmd === "ping") {
  35. const msg = await message.channel.send('Pinging....')
  36.  
  37. msg.edit(`🏓 Pong!'\nLatency is $(Math.floor(msg.createdTimeStamp - message.createdTimestamp)}\nAPI Latency ${Math.round(client.ping)}ms`);
  38. }
  39. });
  40.  
  41. client.login(process.env.TOKEN);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement