mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +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
|
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) => {
|
NO_MUSIC_PLAYING: (data: Message | Interaction) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: `There are no music playing`,
|
title: `There are no music playing`,
|
||||||
@@ -73,10 +79,14 @@ export default class Skip {
|
|||||||
if(instance!.voiceChannel.id !== data.member.voice.channel.id)
|
if(instance!.voiceChannel.id !== data.member.voice.channel.id)
|
||||||
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.USER_NOT_IN_SAME_VOICECHANNEL(data)] }, true);
|
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();
|
instance!.skipTrack();
|
||||||
|
|
||||||
//await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.SKIPPED(data)] });
|
if(instance?.queue.track.length === 0)
|
||||||
|
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.SKIPPED_LASTSONG(data)] });
|
||||||
return;
|
else
|
||||||
|
return await sendMessageOrInteractionResponse(data, { embeds: [EMBEDS.SKIPPED(data)] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,6 +155,10 @@ export class DiscordMusicPlayerInstance {
|
|||||||
this.queue.track.shift();
|
this.queue.track.shift();
|
||||||
this.playTrack(this.queue.track[0]);
|
this.playTrack(this.queue.track[0]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.queue.track.shift();
|
||||||
|
this.player.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async destroy() {
|
public async destroy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user