From 7786c84ea7c35db619ae98aac7d2bde9b4f33295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gro=C3=9F?= Date: Mon, 12 Sep 2022 13:41:45 +0200 Subject: [PATCH] Profile: Render custom status on profile images A new line is added after each whitespace following each 40th+ character --- commands/profile.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/commands/profile.js b/commands/profile.js index 08377c3..70b62b9 100644 --- a/commands/profile.js +++ b/commands/profile.js @@ -23,8 +23,13 @@ module.exports = { let profile = await user.getProfile(); + let customStatus = profile.customStatus; + + customStatus = customStatus.replace(/(.{0,40}[\s])/g, '$1'); + 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());