Profile: Render custom status on profile images

A new line is added after each whitespace following each 40th+ character
This commit is contained in:
2022-09-12 13:41:45 +02:00
parent c5fddd12cf
commit 7786c84ea7

View File

@@ -23,8 +23,13 @@ module.exports = {
let profile = await user.getProfile();
let customStatus = profile.customStatus;
customStatus = customStatus.replace(/(.{0,40}[\s])/g, '<tspan x="443" dy="1.2em">$1</tspan>');
let profileTemplate = fs.readFileSync('/app/assets/profile/profile.svg').toString();
profileTemplate = profileTemplate.replace(/{{USERNAME}}/g, discordUser.username.substr(0,15)+(discordUser.username.length>15?'...':''));
profileTemplate = profileTemplate.replace(/{{PROFILE_TEXT}}/g, customStatus );
profileTemplate = profileTemplate.replace(/{{HEADER_COLOR}}/g, '190,31,97');
profileTemplate = profileTemplate.replace(/{{CC}}/g, await Card.count({where: {userId: user.id}}));
profileTemplate = profileTemplate.replace(/{{LVL}}/g, await user.getLevel());