autoupdate nowplaying every 2 minutes

This commit is contained in:
Jonny_Bro (Nikita) 2023-11-21 01:19:46 +05:00
parent 87360465d1
commit a945f42802
2 changed files with 13 additions and 2 deletions

View file

@ -205,10 +205,21 @@ class Nowplaying extends BaseCommand {
const embed = await updateEmbed(interaction, queue); const embed = await updateEmbed(interaction, queue);
interaction.editReply({ const message = await interaction.editReply({
embeds: [embed], embeds: [embed],
components: [row1, row2], components: [row1, row2],
}); });
const i = setInterval(async function () {
if (message && message.editable && queue.isPlaying()) {
const e = await updateEmbed(interaction, queue);
message.edit({
embeds: [e],
components: [row1, row2],
});
} else clearInterval(i);
}, 2 * 60 * 1000);
} }
} }

View file

@ -29,7 +29,7 @@ class CommandHandler extends BaseEvent {
data.memberData = memberData; data.memberData = memberData;
} }
if (command.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") return interaction.reply({ content: "IAT Only", ephemeral: true }); if (command?.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") return interaction.reply({ content: "IAT Only", ephemeral: true });
if (interaction.isAutocomplete()) return await command.autocompleteRun(client, interaction); if (interaction.isAutocomplete()) return await command.autocompleteRun(client, interaction);
if (interaction.isButton() && interaction.customId === "quote_delete" && interaction.message.deletable) return interaction.message.delete(); if (interaction.isButton() && interaction.customId === "quote_delete" && interaction.message.deletable) return interaction.message.delete();
if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return; if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return;