daily pastebin goal
82%
SHARE
TWEET

codes-searchYT

a guest Jan 16th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   client.on('message',async message => {
  2.   if(message.content.startsWith(prefix + "search")) {
  3.     const args = message.content.split(' ').slice(1).join(' ');
  4.     if(message.content.split(' ')[0] !== `${prefix}search`) return;
  5.     var Search = require('youtube-search'),
  6.     opts = {maxResults: 1, key: 'AIzaSyAdORXg7UZUo7sePv97JyoDqtQVi3Ll0b8', type: 'video'}
  7.  
  8.     Search(args, opts, function(err, results) {
  9.       if(err) return console.log(err);
  10.  
  11.       console.log(results);
  12.       message.channel.send(results[0].link);
  13.     });
  14.   }
  15. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top