mirror of
https://github.com/MinazukiAmane/Tinasha-Bot.git
synced 2025-03-16 05:45:57 +08:00
feat: Node Check
- make sure check if the node connected before skipping - attempt to connect - add logging
This commit is contained in:
parent
6e69e76582
commit
cbfeef5eb8
@ -39,10 +39,23 @@ async function skip({ client, guildId }) {
|
|||||||
|
|
||||||
const title = player.queue.current.info.title;
|
const title = player.queue.current.info.title;
|
||||||
|
|
||||||
if (player.queue.tracks.length === 0) {
|
// Check if the node is connected
|
||||||
return "There is no next song to skip to";
|
const node = player.node;
|
||||||
|
if (!node || !node.connected) {
|
||||||
|
try {
|
||||||
|
await node.connect(); // Attempt to connect the node
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Failed to connect to Lavalink node: ${error.message}`);
|
||||||
|
return "🚫 Failed to connect to the music server. Please try again later.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await player.skip();
|
// Proceed to skip the track
|
||||||
return `⏯️ ${title} was skipped`;
|
try {
|
||||||
|
await player.skip();
|
||||||
|
return `⏯️ ${title} was skipped`;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error while skipping track: ${error.message}`);
|
||||||
|
return "🚫 An error occurred while trying to skip the track.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user