Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Add Button Config
Browse files Browse the repository at this point in the history
  • Loading branch information
Adivise committed Sep 12, 2022
1 parent 213d84d commit 8a6216f
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 89 deletions.
67 changes: 38 additions & 29 deletions commands/Music/NowPlaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] });
Expand Down
67 changes: 37 additions & 30 deletions commands/Music/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ");

Expand Down
54 changes: 33 additions & 21 deletions events/player/trackStart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] });
Expand Down
1 change: 1 addition & 0 deletions nanospace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 8a6216f

Please sign in to comment.