Guest User

Basic Command Handler

a guest
Jan 29th, 2021
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. const Discord = require('discord.js');
  2.  
  3. const client = new Discord.Client();
  4.  
  5. const prefix = '>';
  6.  
  7. client.once('ready', () => {
  8. console.log('Phenixxer is online!');
  9. });
  10.  
  11. client.on('message', message => {
  12. if(!message.content.startsWith(prefix) || message.author.bot) return;
  13.  
  14. const args = message.content.slice(prefix.length).split(/ +/);
  15. const command = args.shift().toLowerCase();
  16.  
  17. if(command === 'ping'){
  18. message.channel.send('pong!')
  19. } else if(command === 'youtube'){
  20. message.channel.send('https://www.youtube.com/channel/UCHVAca-OHLlmf9GqFM3vBwQ')
  21. }
  22. });
  23.  
  24.  
  25.  
  26. client.login('ODA0ODcwNDEyOTYxNzEwMTEx.YBSn_A.hlw2t8UkQBEohwTRBh5G5pZJZFI');
Advertisement
Add Comment
Please, Sign In to add comment