-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlyrics.js
37 lines (31 loc) · 1.25 KB
/
lyrics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { MessageEmbed } = require("discord.js");
const lyricsFinder = require("lyrics-finder");
const sendError = require("../util/error");
module.exports = {
info: {
name: "lyrics",
description: "Get lyrics for the currently playing song",
usage: "[lyrics]",
aliases: ["ly"],
},
run: async function (client, message, args) {
const queue = message.client.queue.get(message.guild.id);
if (!queue) return sendError("There is nothing playing.",message.channel).catch(console.error);
let lyrics = null;
try {
lyrics = await lyricsFinder(queue.songs[0].title, "");
if (!lyrics) lyrics = `No lyrics found for ${queue.songs[0].title}.`;
} catch (error) {
lyrics = `No lyrics found for ${queue.songs[0].title}.`;
}
let lyricsEmbed = new MessageEmbed()
.setAuthor(`${queue.songs[0].title} — Lyrics`, "https://raw.githubusercontent.com/SudhanPlayz/Discord-MusicBot/master/assets/Music.gif")
.setThumbnail(queue.songs[0].img)
.setColor("YELLOW")
.setDescription(lyrics)
.setTimestamp();
if (lyricsEmbed.description.length >= 2048)
lyricsEmbed.description = `${lyricsEmbed.description.substr(0, 2045)}...`;
return message.channel.send(lyricsEmbed).catch(console.error);
},
};