better quote

This commit is contained in:
Ashley Graves 2024-10-20 16:26:35 +02:00
parent 0a07c4e56b
commit 61d800048c
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -22,10 +22,8 @@ module.exports = {
const msg = interaction.targetMessage; const msg = interaction.targetMessage;
const user = msg.author; const user = msg.author;
const avatar = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=1024`; const avatar = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=1024`;
console.log("Generating quote image");
try { try {
const data = await createQuoteImage(avatar, user.displayName, msg.content, true, interaction.client.users.cache); const data = await createQuoteImage(avatar, user.displayName, msg.content, true, interaction.client.users.cache);
console.log("Sending quote image");
await interaction.followUp({ await interaction.followUp({
files: [{ files: [{

View file

@ -29,6 +29,8 @@ function wrapText(context, text, x, y, maxWidth, lineHeight, preparingSentence,
lines.push(preparingSentence.join(" ")); lines.push(preparingSentence.join(" "));
y -= (lines.length * lineHeight) / 2;
lines.forEach(element => { lines.forEach(element => {
const lineWidth = context.measureText(element).width; const lineWidth = context.measureText(element).width;
const xOffset = (maxWidth - lineWidth) / 2; const xOffset = (maxWidth - lineWidth) / 2;