Lanbot_Music_V12/commands/Musique/lyrics.js

31 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2022-01-04 02:35:59 +01:00
const { MessageEmbed } = require("discord.js");
const lyricsFinder = require("lyrics-finder");
const { MESSAGES } = require("../../util/constants");
module.exports.run = async (client, message, args, settings) => {
const queue = message.client.queue.get(message.guild.id);
if (!queue) return message.channel.send("Aucune musique lancé !").catch(console.error);
let lyrics = null;
const title = queue.songs[0].title;
try {
lyrics = await lyricsFinder(queue.songs[0].title, "");
if (!lyrics) lyrics = `Pas de paroles trouvé pour ${queue.songs[0].title} ! `;
} catch (error) {
lyrics = `Pas de paroles trouvé pour ${queue.songs[0].title} ! `;
}
let lyricsEmbed = new MessageEmbed()
.setTitle(`Paroles pour ${queue.songs[0].title}`)
.setDescription(lyrics)
.setColor("GREEN")
.setTimestamp();
if (lyricsEmbed.description.length >= 2048)
lyricsEmbed.description = `${lyricsEmbed.description.substr(0, 2045)}...`;
return message.channel.send(lyricsEmbed).catch(console.error);
}
module.exports.help = MESSAGES.COMMANDS.MUSIQUE.LYRICS;