Facebook
From aaron_jy, 3 Years ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 51
  1. const Discord = require('discord.js')
  2. const bot = new Discord.Client();
  3.  
  4. const { Player } = require('discord-player');
  5. const player = new Player(bot);
  6. bot.player = player;
  7.  
  8. bot.login('Nzc0NjcxODcwMTkxOTkyODQz.X6bLZg.2GAcYw699_8X_0yVhDrSci7uekU')
  9.  
  10.  
  11. bot.on("ready", bot =>{
  12.    
  13.     console.log("Bot is Online!")
  14.  
  15. })
  16.  
  17. bot.on("message", async message => {
  18.  
  19.     const prefix = '?';
  20.  
  21.     const args = message.content.slice(prefix.length).trim().split(/ +/g);
  22.     const command = args.shift().toLowerCase();
  23.  
  24.     if (command === 'play'){
  25.  
  26.         let track = await bot.player.play(message.member.voice.channel, args[0], message.member.user.tag);
  27.         message.channel.send('Currently playing ${track.name}! - Requested by ${track.requestedBy}');
  28.  
  29.     }
  30.  
  31.     if (command === 'stop'){
  32.  
  33.         let track = await bot.player.stop(message.guild.id);
  34.         message.channel.send("STOPPED");
  35.     }
  36.  
  37. })
  38.  
  39.