mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Fix
This commit is contained in:
@@ -83,25 +83,27 @@ module.exports = class TweetCommand extends Command {
|
|||||||
const imageData = await loadImage(body);
|
const imageData = await loadImage(body);
|
||||||
const imageHeightRatio = 740 / imageData.width;
|
const imageHeightRatio = 740 / imageData.width;
|
||||||
imageHeight = imageData.height * imageHeightRatio;
|
imageHeight = imageData.height * imageHeightRatio;
|
||||||
|
const imageCanvas = createCanvas(740, imageHeight);
|
||||||
|
const imageCtx = imageCanvas.getContext('2d');
|
||||||
canvas.height += imageHeight + 15;
|
canvas.height += imageHeight + 15;
|
||||||
ctx.fillRect(0, base1.height, canvas.width, linesLen + imageHeight + 15);
|
ctx.fillRect(0, base1.height, canvas.width, linesLen + imageHeight + 15);
|
||||||
const x = 17;
|
const x = 17;
|
||||||
const y = base1.height + linesLen;
|
const y = base1.height + linesLen;
|
||||||
const imageWidth = 740;
|
const imageWidth = 740;
|
||||||
const radius = 10;
|
const radius = 10;
|
||||||
ctx.beginPath();
|
imageCtx.beginPath();
|
||||||
ctx.moveTo(x + radius, y);
|
imageCtx.moveTo(x + radius, y);
|
||||||
ctx.lineTo(x + imageWidth - radius, y);
|
imageCtx.lineTo(x + imageWidth - radius, y);
|
||||||
ctx.quadraticCurveTo(x + imageWidth, y, x + imageWidth, y + radius);
|
imageCtx.quadraticCurveTo(x + imageWidth, y, x + imageWidth, y + radius);
|
||||||
ctx.lineTo(x + imageWidth, y + imageHeight - radius);
|
imageCtx.lineTo(x + imageWidth, y + imageHeight - radius);
|
||||||
ctx.quadraticCurveTo(x + imageWidth, y + imageHeight, x + imageWidth - radius, y + imageHeight);
|
imageCtx.quadraticCurveTo(x + imageWidth, y + imageHeight, x + imageWidth - radius, y + imageHeight);
|
||||||
ctx.lineTo(x + radius, y + imageHeight);
|
imageCtx.lineTo(x + radius, y + imageHeight);
|
||||||
ctx.quadraticCurveTo(x, y + imageHeight, x, y + imageHeight - radius);
|
imageCtx.quadraticCurveTo(x, y + imageHeight, x, y + imageHeight - radius);
|
||||||
ctx.lineTo(x, y + radius);
|
imageCtx.lineTo(x, y + radius);
|
||||||
ctx.quadraticCurveTo(x, y, x + radius, y);
|
imageCtx.quadraticCurveTo(x, y, x + radius, y);
|
||||||
ctx.closePath();
|
imageCtx.closePath();
|
||||||
ctx.clip();
|
imageCtx.clip();
|
||||||
ctx.drawImage(imageData, x, y, imageWidth, imageHeight);
|
ctx.drawImage(imageCanvas, x, y, imageWidth, imageHeight);
|
||||||
}
|
}
|
||||||
const likes = randomRange(Math.ceil(userData.followers * 0.0015), Math.ceil(userData.followers * 0.002));
|
const likes = randomRange(Math.ceil(userData.followers * 0.0015), Math.ceil(userData.followers * 0.002));
|
||||||
const retweets = randomRange(Math.ceil(userData.followers * 0.00015), Math.ceil(userData.followers * 0.0002));
|
const retweets = randomRange(Math.ceil(userData.followers * 0.00015), Math.ceil(userData.followers * 0.0002));
|
||||||
|
|||||||
Reference in New Issue
Block a user