improved display of user activity in user command

This commit is contained in:
Erik 2021-05-05 17:44:23 +03:00
parent 55cc125cc0
commit 183ca1b1a3

View File

@ -128,6 +128,17 @@ class UserCommand extends Command {
}
};
const activity = activities.reduce((acc, curr) => {
if (acc.length) acc += `\n`;
if (curr.emoji) acc += `<emoji:${curr.emoji.name}> `;
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'
})
};