the resume button should in the disconnect not in trackend lols

This commit is contained in:
Amane Serenetia 2025-01-04 06:53:53 +07:00
parent 24e98fad90
commit db7f036697
2 changed files with 22 additions and 22 deletions

View File

@ -1,4 +1,5 @@
const Queue = require("@src/database/schemas/Queue"); const Queue = require("@src/database/schemas/Queue");
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } = require("discord.js");
module.exports = async (client, player) => { module.exports = async (client, player) => {
const guild = client.guilds.cache.get(player.guildId); const guild = client.guilds.cache.get(player.guildId);
@ -36,4 +37,24 @@ module.exports = async (client, player) => {
if (msg && msg.deletable) { if (msg && msg.deletable) {
await msg.delete().catch(() => {}); await msg.delete().catch(() => {});
} }
// Send a message with a button to resume playback
const channel = guild.channels.cache.get(player.textChannelId);
if (channel) {
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("resume")
.setLabel("Resume Music")
.setStyle(ButtonStyle.Primary)
);
await channel.safeSend({
embeds: [
new EmbedBuilder()
.setColor(EMBED_COLORS.BOT_EMBED)
.setDescription("The music has stopped due to a disconnection. You can resume it by clicking the button below.")
],
components: [row]
});
}
}; };

View File

@ -1,6 +1,5 @@
const { autoplayFunction } = require("@handlers/player"); const { autoplayFunction } = require("@handlers/player");
const { MUSIC, EMBED_COLORS } = require("@root/config.js"); const { MUSIC } = require("@root/config.js");
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require("discord.js");
const Queue = require("@src/database/schemas/Queue"); const Queue = require("@src/database/schemas/Queue");
module.exports = async (client, player, track) => { module.exports = async (client, player, track) => {
@ -33,26 +32,6 @@ module.exports = async (client, player, track) => {
} }
} }
// Send a message with a button to resume playback
const channel = guild.channels.cache.get(player.textChannelId);
if (channel) {
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId("resume")
.setLabel("Resume Music")
.setStyle(ButtonStyle.Primary)
);
await channel.safeSend({
embeds: [
new EmbedBuilder()
.setColor(EMBED_COLORS.BOT_EMBED)
.setDescription("The music has stopped. You can resume it by clicking the button below.")
],
components: [row]
});
}
if (player.get("autoplay") === true) { if (player.get("autoplay") === true) {
await autoplayFunction(client, track, player); await autoplayFunction(client, track, player);
} }