mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
fix repeat mode fr this time
This commit is contained in:
parent
3a4f854fc0
commit
d2cb694ae8
2 changed files with 17 additions and 17 deletions
|
@ -59,18 +59,18 @@ class Loop extends BaseCommand {
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
|
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
|
||||||
|
|
||||||
const translated = {
|
const translated = {
|
||||||
"AUTOPLAY": interaction.translate("music/loop:AUTOPLAY_ENABLED"),
|
"3": interaction.translate("music/loop:AUTOPLAY_ENABLED"),
|
||||||
"QUEUE": interaction.translate("music/loop:QUEUE_ENABLED"),
|
"2": interaction.translate("music/loop:QUEUE_ENABLED"),
|
||||||
"TRACK": interaction.translate("music/loop:TRACK_ENABLED"),
|
"1": interaction.translate("music/loop:TRACK_ENABLED"),
|
||||||
"OFF": interaction.translate("music/loop:LOOP_DISABLED"),
|
"0": interaction.translate("music/loop:LOOP_DISABLED"),
|
||||||
};
|
};
|
||||||
|
|
||||||
const type = interaction.options.getString("option"),
|
const type = interaction.options.getString("option"),
|
||||||
mode = QueueRepeatMode[type];
|
mode = type === "3" ? QueueRepeatMode.AUTOPLAY : type === "2" ? QueueRepeatMode.QUEUE : type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
|
||||||
|
|
||||||
queue.setRepeatMode(mode);
|
queue.setRepeatMode(mode);
|
||||||
|
|
||||||
interaction.reply({ content: translated[mode] });
|
interaction.reply({ content: translated[type] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,12 +92,11 @@ class Nowplaying extends BaseCommand {
|
||||||
|
|
||||||
const filter = i => i.user.id === interaction.user.id,
|
const filter = i => i.user.id === interaction.user.id,
|
||||||
collected = await msg.awaitMessageComponent({ filter, time: 10 * 1000 }),
|
collected = await msg.awaitMessageComponent({ filter, time: 10 * 1000 }),
|
||||||
mode = QueueRepeatMode[collected.values[0]],
|
mode = collected.values[0] === "3" ? QueueRepeatMode.AUTOPLAY : collected.values[0] === "2" ? QueueRepeatMode.QUEUE : collected.values[0] === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF,
|
||||||
translated = {
|
translated = {
|
||||||
"AUTOPLAY": interaction.translate("music/loop:AUTOPLAY_ENABLED"),
|
"3": interaction.translate("music/loop:AUTOPLAY_ENABLED"),
|
||||||
"QUEUE": interaction.translate("music/loop:QUEUE_ENABLED"),
|
"2": interaction.translate("music/loop:QUEUE_ENABLED"),
|
||||||
"TRACK": interaction.translate("music/loop:TRACK_ENABLED"),
|
"1": interaction.translate("music/loop:TRACK_ENABLED"),
|
||||||
"OFF": interaction.translate("music/loop:LOOP_DISABLED"),
|
|
||||||
"0": interaction.translate("music/loop:LOOP_DISABLED"),
|
"0": interaction.translate("music/loop:LOOP_DISABLED"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ class Nowplaying extends BaseCommand {
|
||||||
|
|
||||||
queue.setRepeatMode(mode);
|
queue.setRepeatMode(mode);
|
||||||
|
|
||||||
await interaction.followUp({ content: translated[mode] });
|
await interaction.followUp({ content: translated[collected.values[0]] });
|
||||||
|
|
||||||
const embed = await updateEmbed(interaction, queue);
|
const embed = await updateEmbed(interaction, queue);
|
||||||
|
|
||||||
|
@ -220,14 +219,15 @@ async function updateEmbed(interaction, queue) {
|
||||||
const progressBar = queue.node.createProgressBar(),
|
const progressBar = queue.node.createProgressBar(),
|
||||||
track = queue.currentTrack,
|
track = queue.currentTrack,
|
||||||
data = await interaction.client.guildsData.findOne({ id: interaction.guildId }),
|
data = await interaction.client.guildsData.findOne({ id: interaction.guildId }),
|
||||||
|
mode = queue.repeatMode === QueueRepeatMode.AUTOPLAY ? "3" : queue.repeatMode === QueueRepeatMode.QUEUE ? "2" : queue.repeatMode === QueueRepeatMode.TRACK ? "1" : "0",
|
||||||
translated = {
|
translated = {
|
||||||
"AUTOPLAY": interaction.translate("music/nowplaying:AUTOPLAY"),
|
"3": interaction.translate("music/nowplaying:AUTOPLAY"),
|
||||||
"QUEUE": interaction.translate("music/nowplaying:QUEUE"),
|
"2": interaction.translate("music/nowplaying:QUEUE"),
|
||||||
"TRACK": interaction.translate("music/nowplaying:TRACK"),
|
"1": interaction.translate("music/nowplaying:TRACK"),
|
||||||
"OFF": interaction.translate("common:DISABLED"),
|
|
||||||
"0": interaction.translate("common:DISABLED"),
|
"0": interaction.translate("common:DISABLED"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
|
name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
|
||||||
|
@ -261,7 +261,7 @@ async function updateEmbed(interaction, queue) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "\u200b",
|
name: "\u200b",
|
||||||
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\``,
|
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[mode]}\``,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.setColor(interaction.client.config.embed.color)
|
.setColor(interaction.client.config.embed.color)
|
||||||
|
|
Loading…
Reference in a new issue