[banner] remove square brackets from the banner

This commit is contained in:
Andrea Vos 2021-09-13 20:45:06 +02:00
parent 6dee4d3143
commit 76c5a3bded

View File

@ -98,7 +98,11 @@ router.get('/banner/:pronounName*.png', handleErrorAsync(async (req, res) => {
const pronounNameOptions = pronounName === global.config.pronouns.any ? [global.config.pronouns.any] : pronoun.nameOptions();
context.font = `bold ${pronounNameOptions.length <= 2 ? '70' : '36'}pt Quicksand`
context.fillText(pronounNameOptions.join('\n'), width / leftRatio + imageSize / 1.5, height / 2 + (pronounNameOptions.length <= 2 ? 72 : 24));
context.fillText(
pronounNameOptions.map(o => o.replace(/ ?\[[^\]]+] ?/g, '').trim()).join('\n'),
width / leftRatio + imageSize / 1.5,
height / 2 + (pronounNameOptions.length <= 2 ? 72 : 24)
);
return canvas.toBuffer(mime);
});