diff --git a/commands/Music/NowPlaying.js b/commands/Music/NowPlaying.js index ba073c0..f6a53fc 100644 --- a/commands/Music/NowPlaying.js +++ b/commands/Music/NowPlaying.js @@ -44,54 +44,63 @@ module.exports = { })}`, value: `\`\`\`${Emoji} ${'─'.repeat(Part) + '🎢' + '─'.repeat(30 - Part)}\`\`\``, inline: false }) .setTimestamp(); - const row = new ActionRowBuilder() + const button = client.button.nowplaying; + + const row = new ActionRowBuilder() .addComponents( - new ButtonBuilder() + new ButtonBuilder() .setCustomId("pause") - .setEmoji("⏯") - .setStyle(ButtonStyle.Primary) + .setLabel(`${button.pause.label}`) + .setEmoji(`${button.pause.emoji}`) + .setStyle(ButtonStyle[button.pause.style]) ) .addComponents( - new ButtonBuilder() + new ButtonBuilder() .setCustomId("replay") - .setEmoji("β¬…") - .setStyle(ButtonStyle.Success) + .setLabel(`${button.replay.label}`) + .setEmoji(`${button.replay.emoji}`) + .setStyle(ButtonStyle[button.replay.style]) ) .addComponents( - new ButtonBuilder() + new ButtonBuilder() .setCustomId("stop") - .setEmoji("βœ–") - .setStyle(ButtonStyle.Danger) + .setLabel(`${button.stop.label}`) + .setEmoji(`${button.stop.emoji}`) + .setStyle(ButtonStyle[button.stop.style]) ) .addComponents( - new ButtonBuilder() + new ButtonBuilder() .setCustomId("skip") - .setEmoji("➑") - .setStyle(ButtonStyle.Success) + .setLabel(`${button.skip.label}`) + .setEmoji(`${button.skip.emoji}`) + .setStyle(ButtonStyle[button.pause.style]) ) .addComponents( - new ButtonBuilder() + new ButtonBuilder() .setCustomId("loop") - .setEmoji("πŸ”„") - .setStyle(ButtonStyle.Primary) + .setLabel(`${button.loop.label}`) + .setEmoji(`${button.loop.emoji}`) + .setStyle(ButtonStyle[button.loop.style]) ) const NEmbed = await msg.edit({ content: " ", embeds: [embeded], components: [row] }); + /// RUN THIS ON SET TO TRUE if (realtime === 'true') { - client.interval = setInterval(async () => { - if (!player.playing) return; - const CurrentDuration = formatDuration(player.position); - const Part = Math.floor(player.position / song.duration * 30); - const Emoji = player.playing ? "πŸ”΄ |" : "⏸ |"; - - embeded.data.fields[6] = { name: `${client.i18n.get(language, "music", "np_current_duration", { - current_duration: CurrentDuration, - total_duration: TotalDuration - })}`, value: `\`\`\`${Emoji} ${'─'.repeat(Part) + '🎢' + '─'.repeat(30 - Part)}\`\`\`` }; - - if (NEmbed) NEmbed.edit({ content: " ", embeds: [embeded], components: [row] }) - }, 5000); + client.interval = setInterval(async () => { + if (!player.playing) return; + const CurrentDuration = formatDuration(player.position); + const Part = Math.floor(player.position / song.duration * 30); + const Emoji = player.playing ? "πŸ”΄ |" : "⏸ |"; + + embeded.data.fields[6] = { name: `${client.i18n.get(language, "music", "np_current_duration", { + current_duration: CurrentDuration, + total_duration: TotalDuration + })}`, value: `\`\`\`${Emoji} ${'─'.repeat(Part) + '🎢' + '─'.repeat(30 - Part)}\`\`\`` }; + + if (NEmbed) NEmbed.edit({ content: " ", embeds: [embeded], components: [row] }) + }, 5000); + /// RUN THIS ON SET TO FALSE } else if (realtime === 'false') { if (!player.playing) return; if (NEmbed) NEmbed.edit({ content: " ", embeds: [embeded], components: [row] }); diff --git a/commands/Music/Search.js b/commands/Music/Search.js index 956b405..636aa87 100644 --- a/commands/Music/Search.js +++ b/commands/Music/Search.js @@ -26,37 +26,44 @@ module.exports = { selfDeafen: true, }); + const button = client.button.search; + const row = new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setCustomId("one") - .setEmoji("1️⃣") - .setStyle(ButtonStyle.Secondary) - ) - .addComponents( - new ButtonBuilder() - .setCustomId("two") - .setEmoji("2️⃣") - .setStyle(ButtonStyle.Secondary) - ) - .addComponents( - new ButtonBuilder() - .setCustomId("three") - .setEmoji("3️⃣") - .setStyle(ButtonStyle.Secondary) - ) - .addComponents( - new ButtonBuilder() - .setCustomId("four") - .setEmoji("4️⃣") - .setStyle(ButtonStyle.Secondary) - ) - .addComponents( - new ButtonBuilder() - .setCustomId("five") - .setEmoji("5️⃣") - .setStyle(ButtonStyle.Secondary) - ) + .addComponents( + new ButtonBuilder() + .setCustomId("one") + .setLabel(`${button.one.label}`) + .setEmoji(`${button.one.emoji}`) + .setStyle(ButtonStyle[button.one.style]) + ) + .addComponents( + new ButtonBuilder() + .setCustomId("two") + .setLabel(`${button.two.label}`) + .setEmoji(`${button.two.emoji}`) + .setStyle(ButtonStyle[button.two.style]) + ) + .addComponents( + new ButtonBuilder() + .setCustomId("three") + .setLabel(`${button.three.label}`) + .setEmoji(`${button.three.emoji}`) + .setStyle(ButtonStyle[button.three.style]) + ) + .addComponents( + new ButtonBuilder() + .setCustomId("four") + .setLabel(`${button.four.label}`) + .setEmoji(`${button.four.emoji}`) + .setStyle(ButtonStyle[button.four.style]) + ) + .addComponents( + new ButtonBuilder() + .setCustomId("five") + .setLabel(`${button.five.label}`) + .setEmoji(`${button.five.emoji}`) + .setStyle(ButtonStyle[button.five.style]) + ) const search = args.join(" "); diff --git a/events/player/trackStart.js b/events/player/trackStart.js index a485fb8..f327b1b 100644 --- a/events/player/trackStart.js +++ b/events/player/trackStart.js @@ -49,69 +49,81 @@ module.exports = async (client, player, track, payload) => { current_duration: formatduration(track.duration, true), })}`, value: `\`\`\`πŸ”΄ | πŸŽΆβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€\`\`\``, inline: true }) .setTimestamp(); - + + const button = client.button.trackStart; + const row = new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId("pause") - .setEmoji("⏯") - .setStyle(ButtonStyle.Success) + .setLabel(`${button.pause.label}`) + .setEmoji(`${button.pause.emoji}`) + .setStyle(ButtonStyle[button.pause.style]) ) .addComponents( new ButtonBuilder() .setCustomId("replay") - .setEmoji("β¬…") - .setStyle(ButtonStyle.Primary) + .setLabel(`${button.replay.label}`) + .setEmoji(`${button.replay.emoji}`) + .setStyle(ButtonStyle[button.replay.style]) ) .addComponents( new ButtonBuilder() .setCustomId("stop") - .setEmoji("βœ–") - .setStyle(ButtonStyle.Danger) + .setLabel(`${button.stop.label}`) + .setEmoji(`${button.stop.emoji}`) + .setStyle(ButtonStyle[button.stop.style]) ) .addComponents( new ButtonBuilder() .setCustomId("skip") - .setEmoji("➑") - .setStyle(ButtonStyle.Primary) + .setLabel(`${button.skip.label}`) + .setEmoji(`${button.skip.emoji}`) + .setStyle(ButtonStyle[button.pause.style]) ) .addComponents( new ButtonBuilder() .setCustomId("loop") - .setEmoji("πŸ”„") - .setStyle(ButtonStyle.Success) + .setLabel(`${button.loop.label}`) + .setEmoji(`${button.loop.emoji}`) + .setStyle(ButtonStyle[button.loop.style]) ) const row2 = new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId("shuffle") - .setEmoji("πŸ”€") - .setStyle(ButtonStyle.Success) + .setLabel(`${button.shuffle.label}`) + .setEmoji(`${button.shuffle.emoji}`) + .setStyle(ButtonStyle[button.shuffle.style]) ) .addComponents( new ButtonBuilder() .setCustomId("voldown") - .setEmoji("πŸ”‰") - .setStyle(ButtonStyle.Primary) + .setLabel(`${button.voldown.label}`) + .setEmoji(`${button.voldown.emoji}`) + .setStyle(ButtonStyle[button.voldown.style]) ) .addComponents( new ButtonBuilder() .setCustomId("clear") - .setEmoji("πŸ—‘") - .setStyle(ButtonStyle.Danger) + .setLabel(`${button.clear.label}`) + .setEmoji(`${button.clear.emoji}`) + .setStyle(ButtonStyle[button.clear.style]) ) .addComponents( new ButtonBuilder() .setCustomId("volup") - .setEmoji("πŸ”Š") - .setStyle(ButtonStyle.Primary) + .setLabel(`${button.volup.label}`) + .setEmoji(`${button.volup.emoji}`) + .setStyle(ButtonStyle[button.volup.style]) ) .addComponents( new ButtonBuilder() .setCustomId("queue") - .setEmoji("πŸ“‹") - .setStyle(ButtonStyle.Success) + .setLabel(`${button.queue.label}`) + .setEmoji(`${button.queue.emoji}`) + .setStyle(ButtonStyle[button.queue.style]) ) const nplaying = await client.channels.cache.get(player.textChannel).send({ embeds: [embeded], components: [row, row2] }); diff --git a/nanospace.js b/nanospace.js index 55418e3..f19bd16 100644 --- a/nanospace.js +++ b/nanospace.js @@ -25,6 +25,7 @@ class MainClient extends Client { }); this.config = require("./settings/config.js"); + this.button = require("./settings/button.js"); this.prefix = this.config.PREFIX; this.owner = this.config.OWNER_ID; this.dev = this.config.DEV_ID; diff --git a/settings/button.js b/settings/button.js new file mode 100644 index 0000000..8019c74 --- /dev/null +++ b/settings/button.js @@ -0,0 +1,139 @@ +module.exports = { + trackStart: { + // Section 1 + pause: { + label: "Pause", // Set Button Name // Not use set to here " " + emoji: "⏯", // Set Button Emoji + style: "Success" //Primary //Secondary //Success //Danger + }, + replay: { + label: "Replay", + emoji: "β¬…", + style: "Primary" + }, + stop: { + label: "Stop", + emoji: "βœ–", + style: "Danger" + }, + skip: { + label: "Skip", + emoji: "➑", + style: "Primary" + }, + loop: { + label: "Loop", + emoji: "πŸ”", + style: "Success" + }, + + // Section 2 + shuffle: { + label: "Shuffle", + emoji: "πŸ”€", + style: "Primary" + }, + voldown: { + label: "Vol -", + emoji: "πŸ”‰", + style: "Success" + }, + clear: { + label: "Clear", + emoji: "πŸ—‘", + style: "Secondary" + }, + volup: { + label: "Vol +", + emoji: "πŸ”Š", + style: "Success" + }, + queue: { + label: "Queue", + emoji: "πŸ“‹", + style: "Primary" + }, + }, + + nowplaying: { + pause: { + label: "Pause", // Set Button Name // Not use set to here " " + emoji: "⏯", // Set Button Emoji + style: "Success" //Primary //Secondary //Success //Danger + }, + replay: { + label: "Replay", + emoji: "β¬…", + style: "Primary" + }, + stop: { + label: "Stop", + emoji: "βœ–", + style: "Danger" + }, + skip: { + label: "Skip", + emoji: "➑", + style: "Primary" + }, + loop: { + label: "Loop", + emoji: "πŸ”", + style: "Success" + }, + }, + + search: { + one: { + label: " ", // Set Button Name // Not use set to here " " + emoji: "1️⃣", // Set Button Emoji + style: "Secondary" //Primary //Secondary //Success //Danger + }, + two: { + label: " ", + emoji: "2️⃣", + style: "Secondary" + }, + three: { + label: " ", + emoji: "3️⃣", + style: "Secondary" + }, + four: { + label: " ", + emoji: "4️⃣", + style: "Secondary" + }, + five: { + label: " ", + emoji: "5️⃣", + style: "Secondary" + }, + }, + + queue_page: { + back: { + label: " ", + emoji: "β¬…", + style: "Secondary" + }, + next: { + label: " ", + emoji: "➑", + style: "Secondary" + }, + }, + + playlist_page: { + back: { + label: " ", + emoji: "β¬…", + style: "Secondary" + }, + next: { + label: " ", + emoji: "➑", + style: "Secondary" + }, + } +} \ No newline at end of file diff --git a/structures/PageQueue.js b/structures/PageQueue.js index 1cdae85..11afa01 100644 --- a/structures/PageQueue.js +++ b/structures/PageQueue.js @@ -4,14 +4,18 @@ const NormalPage = async (client, message, pages, timeout, queueLength, queueDur if (!message && !message.channel) throw new Error('Channel is inaccessible.'); if (!pages) throw new Error('Pages are not given.'); + const button = client.button.queue_page; + const row1 = new ButtonBuilder() .setCustomId('back') - .setLabel('β¬…') - .setStyle(ButtonStyle.Secondary) + .setLabel(`${button.back.label}`) + .setEmoji(`${button.back.emoji}`) + .setStyle(ButtonStyle[button.back.style]) const row2 = new ButtonBuilder() .setCustomId('next') - .setLabel('➑') - .setStyle(ButtonStyle.Secondary) + .setLabel(`${button.next.label}`) + .setEmoji(`${button.next.emoji}`) + .setStyle(ButtonStyle[button.next.style]) const row = new ActionRowBuilder() .addComponents(row1, row2) @@ -58,14 +62,17 @@ const NormalPlaylist = async (client, message, pages, timeout, queueLength, lang if (!message && !message.channel) throw new Error('Channel is inaccessible.'); if (!pages) throw new Error('Pages are not given.'); + const button = client.button.playlist_page; + const row1 = new ButtonBuilder() .setCustomId('back') - .setLabel('β¬…') - .setStyle(ButtonStyle.Secondary) + .setLabel(`${button.back.label}`) + .setEmoji(`${button.back.emoji}`) + .setStyle(ButtonStyle[button.back.style]) const row2 = new ButtonBuilder() - .setCustomId('next') - .setLabel('➑') - .setStyle(ButtonStyle.Secondary) + .setLabel(`${button.next.label}`) + .setEmoji(`${button.next.emoji}`) + .setStyle(ButtonStyle[button.next.style]) const row = new ActionRowBuilder() .addComponents(row1, row2)