Advertisement
Guest User

My Code

a guest
May 23rd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. const Discord = require('discord.js');
  2. const bot = new Discord.Client();
  3.  
  4. const token = 'NTgxMjYzMzU4NTMxOTkzNjE3.XOc53A.AjJ6FyT6_mJwB3MAvijd-xId1Zo';
  5. const ytdl = require ("ytdl-core")
  6.  
  7. exports.run = async (client, message, args, ops) => {
  8. if (!message.member.voiceChannel) return message.send ("This Aint no rocket science homie CONNECT TO A VOICE CHANNEL!");
  9.  
  10. //This checks if the bot is in a voice channel already!
  11. if (message.guild.me.voiceChannel) return message.channel.send("Lol Homie the bot already in someone else channel!");
  12.  
  13. if (!args[0]) return message.channel.send("OK great a bot smarter than u PUT IN A LINK!");
  14.  
  15. let validate = await ytdl.validateURL(args[0]);
  16.  
  17. if (!validate) return message.channel.send("yo homie you broke me try again!");
  18.  
  19. let info = await ytdl.getInfo(args[0]);
  20.  
  21. let connnection = await message.member.voiceChannel.join();
  22.  
  23. let dispatcher = await connection.playStream(ytdl(args[0], { filter: 'audioonly'}));
  24.  
  25. message.channel.send("Alr homie im playing: $(info.title");
  26.  
  27.  
  28. }
  29.  
  30. module.exports.help = {
  31. name: "play"
  32. }
  33.  
  34. const servers ={};
  35.  
  36. const PREFIX = '?';
  37.  
  38.  
  39. bot.on('ready',() =>{
  40. console.log('This bot is online!')
  41. });
  42.  
  43. bot.on('message', message=>{
  44.  
  45. let args = message.content.substring(PREFIX.length).split(" ");
  46.  
  47. switch(args[0]){
  48. case 'ping':
  49. message.reply('pong!');
  50. break;
  51. case 'info':
  52. message.reply('This bot was created by ItszKev to use it on your server click https://discordapp.com/oauth2/authorize?client_id=581263358531993617&scope=bot&permissions=0');
  53. break;
  54. case 'clear':
  55. if(!args[1]) return message.reply('how much should I clear?')
  56. message.channel.bulkDelete(args[1]);
  57. break;
  58.  
  59. }
  60. });
  61.  
  62.  
  63. bot.login(token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement