-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(v1.4) General improvements & lyrics cmd
+ Merged volume buttons under the now playing embeds to a single adjust button, allowing the user to input a specific value within an modal menu (#18). + New lyrics command implemented (#19). + Fixed an issue allowing the user to use the clear queue and shuffle queue buttons even though no songs are queued. This will now return an ephemeral error reply. + Altered song search flow. Specifically, when the search embed is returned and once the user selects a song through the menu, the original search embed will be edited to the "added to queue" embed, rather than posting separately and leaving the previous search embed as "spam" in the chat. + Re-implemented playlist support for Plex commands (was temporarily removed previously due to Plex search overhaul). + Fixed issues with Spotify songs sometimes not playing without an error, as well as YT Music playlists specifically not working (#8 & #9). + Fixed bug with previous song button not working (#12). + Fixed an occurrence of an 0 username tag.
- Loading branch information
1 parent
317292a
commit 4c9a9e2
Showing
9 changed files
with
214 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require("dotenv").config(); | ||
const { SlashCommandBuilder } = require("@discordjs/builders"); | ||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require("discord.js"); | ||
const { Player } = require('discord-player'); | ||
const { lyricsExtractor } = require("@discord-player/extractor"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("lyrics") | ||
.setDescription("Get the lyrics for a song!") | ||
.addStringOption((option) => option | ||
.setName("query") | ||
.setDescription("Enter the name of the song.") | ||
.setRequired(true) | ||
), | ||
async execute(interaction) { | ||
if (client.config.enableDjMode) { | ||
if (!interaction.member.roles.cache.has(client.config.djRole)) return interaction.reply({ content: `❌ | DJ Mode is active! You must have the DJ role <@&${client.config.djRole}> to use any music commands!`, ephemeral: true }); | ||
} | ||
|
||
var query = interaction.options.getString("query"); | ||
const extractor = lyricsExtractor(); | ||
|
||
var findLyrics = await extractor.search(query) | ||
.catch(err => {}) | ||
|
||
if (!findLyrics) return interaction.reply({ content: `❌ | No lyrics were found for the requested query!`, ephemeral: true }); | ||
let splicedLyrics = findLyrics.lyrics.slice(0, 4000) | ||
|
||
const lyricsembed = new EmbedBuilder() | ||
.setAuthor({ name: interaction.client.user.tag, iconURL: interaction.client.user.displayAvatarURL() }) | ||
//.setThumbnail(interaction.guild.iconURL({dynamic: true})) | ||
.setColor(client.config.embedColour) | ||
.setTitle(`Lyrics for ${findLyrics.title} by ${findLyrics.artist.name} 🎶`) | ||
.setDescription(findLyrics.lyrics.length > 4000 ? splicedLyrics + '\nAnd more...' : findLyrics.lyrics) | ||
.setTimestamp() | ||
.setFooter({ text: `Requested by: ${interaction.user.discriminator != 0 ? interaction.user.tag : interaction.user.username}` }) | ||
|
||
var actionbuttons = new ActionRowBuilder() | ||
.addComponents( | ||
new ButtonBuilder() | ||
.setCustomId("np-delete") | ||
.setStyle(4) | ||
.setLabel("🗑️"), | ||
//.addOptions(options) | ||
new ButtonBuilder() | ||
.setURL(findLyrics.url) | ||
.setStyle(5) //Link | ||
.setLabel("🎶 Full Lyrics"), | ||
//.addOptions(options) | ||
) | ||
|
||
interaction.reply({ embeds: [lyricsembed], components: [actionbuttons] }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.