SHARE
TWEET

Untitled

a guest May 19th, 2017 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2. const client = new Discord.Client();
  3. const YTDL = require('ytdl-core');
  4.  
  5. const X = '|';
  6.  
  7. client.on('ready', () => {
  8.   console.log(`Logged in as ${client.user.username}!`);
  9. });
  10.  
  11. client.on('message', msg => {
  12.   if (msg.content === 'ping') {
  13.     msg.reply('Pong!');
  14.   }
  15. });
  16.  
  17. client.login('MzE0ODUwNjU0MjczNDA0OTI4.C_-OVA.NQvY-bdaa3aJLzZny6OloJDPsjM');
  18.  
  19. client.on('message', msg => {
  20.   if (msg.content === 'help') {
  21.     msg.channel.sendMessage('This command is in development. Please wait.');
  22.   }
  23. });
  24.  
  25.     var args = message.content.substring(X.length).split(" ");
  26.  
  27.     switch(args[0].toLowerCase()) {
  28.         case 'help':
  29.             message.channel.sendMessage('```My prefix is "|"```');
  30.             message.channel.sendMessage('```-> help - Shows this help message```');
  31.             message.channel.sendMessage('```-> playlist - Displays the song-playlist```');
  32.             message.channel.sendMessage('```-> play - Adds a song to the playlist```');
  33.             message.channel.sendMessage('```-> skip - Skips the current song```');
  34.         break;
  35.  
  36.         case 'playlist':
  37.             var embed = new Discord.RichEmbed()
  38.                 .addField('Playing', 'PUT THIS HERE', true)
  39.                 .setColor(0x00ff00)
  40.                 .setFooter('This is the song playlist.')
  41.             message.channel.sendEmbed(embed);
  42.         break;
  43.  
  44.         case 'play':
  45.             if(!args[1]) {
  46.                 message.channel.sendMessage('Oops! Looks like you forgot to provide a link.');
  47.             return;
  48.             }
  49.             if(!message.member.voiceChannel) {
  50.                 message.channel.sendMessage('Sorry! You are not in a voice channel.');
  51.             return;
  52.             }
  53.             if(!servers[message.guild.id]) servers[message.guild.id] = {
  54.                 queue: []
  55.             };
  56.             var server = servers[message.guild.id];
  57.             server.queue.push(args[1]);
  58.             if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection) {
  59.  
  60.                 play(connection, message);
  61.             });
  62.             break;
  63.  
  64.             case 'skip':
  65.                 var server = servers[message.guild.id];
  66.                 if(server.dispatcher) server.dispatcher.end();
  67.             break;
  68.  
  69.             case 'stop':
  70.                 var server = servers[message.guild.id];
  71.                 if(message.guild.voiceConnection) message.guild.voiceConnection.disconnect();
  72.             break;
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top