From 183ca1b1a3b4769413990576e6923ab744f586ce Mon Sep 17 00:00:00 2001 From: Navy Date: Wed, 5 May 2021 17:44:23 +0300 Subject: [PATCH] improved display of user activity in user command --- .../client/components/commands/information/User.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/structure/client/components/commands/information/User.js b/structure/client/components/commands/information/User.js index 69ec2bb..96d5499 100644 --- a/structure/client/components/commands/information/User.js +++ b/structure/client/components/commands/information/User.js @@ -128,6 +128,17 @@ class UserCommand extends Command { } }; + const activity = activities.reduce((acc, curr) => { + + if (acc.length) acc += `\n`; + if (curr.emoji) acc += ` `; + if (curr.type !== 'CUSTOM_STATUS') acc += `${curr.name}\n`; + if (curr.state) acc += curr.state; + + return acc; + + }, ''); + const userField = { name: message.format('C_USER_DATA_NAME'), value: message.format('C_USER_DATA', { @@ -136,7 +147,7 @@ class UserCommand extends Command { created: user.createdAt.toDateString(), status: user.presence.status, // eslint-disable-next-line no-nested-ternary - activity: activities.length > 0 ? activities[0].type === 'CUSTOM_STATUS' ? `${activities[0].name}: ${activities[0].state || 'emoji'}` : activities[0].name : 'Nothing', + activity, //activity: activities.length > 0 ? activities[0].type === 'CUSTOM_STATUS' ? `${activities[0].name}: ${activities[0].state || 'emoji'}` : activities[0].name : 'Nothing', globalActivity: user.lastMessage ? user.lastMessage.createdAt.toDateString() : 'N/A' }) };