Skip to content

Commit

Permalink
fix: TypeError: createCard is not a function in queue (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
LewdHuTao authored Mar 8, 2024
1 parent c62a653 commit cf7b11f
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions djs-bot/commands/music/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ const command = new SlashCommand()
});
}

await interaction.deferReply().catch(() => {
});
await interaction.deferReply().catch(() => {});

const queue = player.queue;
if (!queue.length) {
Expand All @@ -64,7 +63,7 @@ const command = new SlashCommand()
imageText: song.title,
trackStream: song.isStream,
trackDuration: player.position,
trackTotalDuration: song.duration
trackTotalDuration: song.duration,
});

const attachment = new AttachmentBuilder(cardImage, { name: "card.png" });
Expand Down Expand Up @@ -95,13 +94,13 @@ const command = new SlashCommand()
const song = player.queue.current;
const noBgURL = path.join(__dirname, "..", "..", "assets", "no_bg.png");

const cardImage = await createCard(
(imageBg = song.displayThumbnail("maxresdefault") || noBgURL),
(imageText = song.title),
(trackStream = song.isStream),
(trackDuration = player.position),
(trackTotalDuration = song.duration)
);
const cardImage = await classicCard({
imageBg: song.displayThumbnail("maxresdefault") || noBgURL,
imageText: song.title,
trackStream: song.isStream,
trackDuration: player.position,
trackTotalDuration: song.duration,
});

const attachment = new AttachmentBuilder(cardImage, { name: "card.png" });

Expand Down Expand Up @@ -129,9 +128,13 @@ const command = new SlashCommand()
currentGroup
.map(
(song, index) =>
`**${currentPage * 10 + index + 1}**. [${escapeMarkdown(
song.title
)}](${song.uri}) \`[${pms(song.duration)}]\` | ${song.requester}`
`**${
currentPage * 10 + index + 1
}**. [${escapeMarkdown(song.title)}](${
song.uri
}) \`[${pms(song.duration)}]\` | ${
song.requester
}`
)
.join("\n")
)
Expand All @@ -143,9 +146,7 @@ const command = new SlashCommand()
const queueMessage = await interaction.editReply({
embeds: [embed, queueEmbed],
files: [attachment],
components: [
getButtons(currentPage, maxPage)
],
components: [getButtons(currentPage, maxPage)],
});

const filter = (i) => i.user.id === interaction.user.id;
Expand All @@ -169,19 +170,21 @@ const command = new SlashCommand()
currentGroup
.map(
(song, index) =>
`**${currentPage * 10 + index + 1}**. [${escapeMarkdown(
`**${
currentPage * 10 + index + 1
}**. [${escapeMarkdown(
song.title
)}](${song.uri}) \`[${pms(song.duration)}]\` | ${song.requester}`
)}](${song.uri}) \`[${pms(
song.duration
)}]\` | ${song.requester}`
)
.join("\n")
)
.setFooter({ text: `Page ${currentPage + 1} of ${maxPage}` });

await button.update({
embeds: [embed, queueEmbed],
components: [
getButtons(currentPage, maxPage)
],
components: [getButtons(currentPage, maxPage)],
});
});
});
Expand Down

0 comments on commit cf7b11f

Please sign in to comment.