Facebook
From BIGGZ, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 166
  1. ////// - ek/lyrics.js - //////
  2. const valpha = require('bwapi');
  3. const lyrics = new valpha({
  4.   headers: {
  5.     'User-Agent': 'Bastion Discord Bot (https://bastionbot.org)'
  6.   }
  7. });
  8.  
  9. module.exports = (path, options) => {
  10.   return new Promise(async (resolve, reject) => {
  11.     try {
  12.       let response = await lyrics.request(path, options);
  13.  
  14.       resolve(response);
  15.     }
  16.     catch (e) {
  17.       reject(e);
  18.     }
  19.   });
  20. };
  21. ////// - - //////
  22.  
  23. //////komutlar/lyrics.js///////
  24.  
  25. const Discord = require('discord.js')
  26.  
  27. exports.run = async (client, message, args) => {
  28.  
  29.     args.song = args.join(' ');
  30.  
  31. const lyric = require('../ek/lyrics')
  32.  
  33.   let yanıt = await lyric(`/song/${args.song}`);
  34.  
  35.   if (yanıt.error) {
  36.     const embed = new Discord.RichEmbed()
  37.     .setColor(0x36393E)
  38.     .setTitle('Bulunamadı.')
  39.     .setDescription(`**${args.song}** adında lyrics bulunamadı. Doğru şarkıyı aradığına eminsen arama terimine şarkı sahibinide ekle ve yeniden dene.`)
  40.     return await message.channel.send(embed);
  41.   }
  42. const bmended = new Discord.RichEmbed()
  43. .setColor(0x36393E)
  44. .setAuthor(yanıt.artist.name, yanıt.artist.image)
  45. .setTitle(yanıt.name)
  46. .setDescription(yanıt.lyrics.length > 2048
  47.                ? `${yanıt.lyrics.substring(0,2045)}...`
  48.                : yanıt.lyrics)
  49. .setThumbnail(yanıt.image)
  50.   await message.channel.send(bmended);
  51. };
  52.  
  53. exports.conf = {
  54.   enabled: true,
  55.   guildOnly: false,
  56.   aliases: [],
  57.   permLevel: 0  
  58. };
  59.  
  60. exports.help = {
  61.   name: 'lyrics',
  62.   description: 'Belirtilen şarkının sözlerini atar.',
  63.   category:'Kullanıcı',
  64.   usage: 'lyrics [ŞARKI] [ARTIST]',
  65. };
  66.  
  67. ///////////////