mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 06:37:32 +02:00
Decrease font size to allow more characters
This commit is contained in:
@@ -38,7 +38,7 @@ module.exports = class SosCommand extends Command {
|
|||||||
key: 'message',
|
key: 'message',
|
||||||
prompt: 'What should Esther spell out to signal for help?',
|
prompt: 'What should Esther spell out to signal for help?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 4
|
max: 20
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -55,6 +55,11 @@ module.exports = class SosCommand extends Command {
|
|||||||
ctx.textAlign = 'center';
|
ctx.textAlign = 'center';
|
||||||
ctx.textBaseline = 'middle';
|
ctx.textBaseline = 'middle';
|
||||||
ctx.rotate(15 * (Math.PI / 180));
|
ctx.rotate(15 * (Math.PI / 180));
|
||||||
|
let fontSize = 90;
|
||||||
|
while (ctx.measureText(message).width > 130) {
|
||||||
|
fontSize -= 1;
|
||||||
|
ctx.font = `${fontSize}px Noto`;
|
||||||
|
}
|
||||||
ctx.fillText(message.toUpperCase(), 362, 522);
|
ctx.fillText(message.toUpperCase(), 362, 522);
|
||||||
ctx.rotate(-15 * (Math.PI / 180));
|
ctx.rotate(-15 * (Math.PI / 180));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sos.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sos.png' }] });
|
||||||
|
|||||||
Reference in New Issue
Block a user