Skip to content

Commit

Permalink
chore: Update music pause and resume commands
Browse files Browse the repository at this point in the history
This commit updates the music pause and resume commands to improve the music panel display. It modifies the code to use the updated `panel.embed` and `panel.file` properties for the embed and files in the panel. This change ensures that the pause and resume buttons are correctly displayed in the music panel.

Note: The commit message has been generated based on the provided code changes and recent repository commits.
  • Loading branch information
Fyphen1223 authored Jun 1, 2024
1 parent a4748f4 commit 369e096
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion commands/music/pause.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ module.exports = {
await interaction.editReply({ embeds: [embed] });
const panel = await createMusicEmbed(guildId);
await globalThis.queue[guildId].panel.edit({
embeds: [panel],
embeds: [panel.embed],
components: createButton('pause'),
files: [panel.file],
});
return;
},
Expand Down
6 changes: 3 additions & 3 deletions commands/music/resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ module.exports = {
return;
}
}

await globalThis.queue[guildId].player.get();
console.log(await globalThis.queue[guildId].player.get());
await globalThis.queue[guildId].player.resume();
const embed = createMessageEmbed(
getLocale(guilds[guildId].locale).vc.resumed,
Expand All @@ -46,8 +45,9 @@ module.exports = {
await interaction.editReply({ embeds: [embed] });
const panel = await createMusicEmbed(guildId);
await globalThis.queue[guildId].panel.edit({
embeds: [panel],
embeds: [panel.embed],
components: createButton('resume'),
files: [panel.file],
});
return;
},
Expand Down
14 changes: 10 additions & 4 deletions util/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ async function generateMusicCard(current, guildId) {
ctx.fillStyle = '#26aed4';
ctx.fillText('by', 200 * 2, 90 * 2);


let ratio;
if (queue[guildId].player.position == 0) {
ratio = 0;
} else {
ratio = queue[guildId].player.position / current.length / 1000;
}

ctx.fillStyle = '#646464';
ctx.fillRect(100, 575, canvas.width - 200, 10);

console.log(880 * ratio);
ctx.fillStyle = '#26aed4';
ctx.fillRect(100, 575, 200, 10);

ctx.fillRect(100, 575, 880 * ratio * 1000, 10);
//1080
//880
ctx.fillStyle = '#ffffff';
ctx.font = '35px "Jakarta", "FiraCode", "NotoSansJP", "Arial"';
ctx.fillText(formatTime(globalThis.queue[guildId].player.position / 1000), 100, 550);
Expand Down

0 comments on commit 369e096

Please sign in to comment.