mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 10:49:20 +00:00
Support skip on last song
This commit is contained in:
@@ -12,6 +12,12 @@ const EMBEDS = {
|
||||
user: (data instanceof Interaction) ? data.user : data.author
|
||||
});
|
||||
},
|
||||
SKIPPED_LASTSONG: (data: Message | Interaction) => {
|
||||
return makeSuccessEmbed({
|
||||
title: `Skipped, that was the last song`,
|
||||
user: (data instanceof Interaction) ? data.user : data.author
|
||||
});
|
||||
},
|
||||
NO_MUSIC_PLAYING: (data: Message | Interaction) => {
|
||||
return makeErrorEmbed({
|
||||
title: `There are no music playing`,
|
||||
@@ -73,10 +79,14 @@ export default class Skip {
|
||||
if(instance!.voiceChannel.id !== data.member.voice.channel.id)
|
||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.USER_NOT_IN_SAME_VOICECHANNEL(data)] }, true);
|
||||
|
||||
if(instance?.queue.track.length === 0)
|
||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.NO_MUSIC_PLAYING(data)] });
|
||||
|
||||
instance!.skipTrack();
|
||||
|
||||
//await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.SKIPPED(data)] });
|
||||
|
||||
return;
|
||||
if(instance?.queue.track.length === 0)
|
||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.SKIPPED_LASTSONG(data)] });
|
||||
else
|
||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.SKIPPED(data)] });
|
||||
}
|
||||
}
|
||||
@@ -155,6 +155,10 @@ export class DiscordMusicPlayerInstance {
|
||||
this.queue.track.shift();
|
||||
this.playTrack(this.queue.track[0]);
|
||||
}
|
||||
else {
|
||||
this.queue.track.shift();
|
||||
this.player.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public async destroy() {
|
||||
|
||||
Reference in New Issue
Block a user