From d971e126db0009c54773875f9dc81d71cd3783a1 Mon Sep 17 00:00:00 2001 From: Navy Date: Sun, 19 Apr 2020 22:53:36 +0300 Subject: [PATCH] reformat to fit templating, needs some work still --- .../components/commands/utility/User.js | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/structure/client/components/commands/utility/User.js b/structure/client/components/commands/utility/User.js index a8bc6c8..cdacece 100644 --- a/structure/client/components/commands/utility/User.js +++ b/structure/client/components/commands/utility/User.js @@ -17,9 +17,8 @@ class UserCommand extends Command { } - async execute(message, { args, params }) { + async execute(message, { params }) { - console.log(args, params); let search = params[0] ? params[0].toLowerCase() === 'search' : false; let response = ''; if(search && params.length > 1) { @@ -39,13 +38,11 @@ class UserCommand extends Command { } response = { - embed: { - description: response, - title: `Search result for keyword: \`${key}\``, - color: 0x0088cc, - footer: { - text: `Found ${members.size} matches, displaying ${count}` - } + description: response, + title: `Search result for keyword: \`${key}\``, + color: 0x0088cc, + footer: { + text: `Found ${members.size} matches, displaying ${count}` } }; @@ -55,28 +52,29 @@ class UserCommand extends Command { if(!user) return message.respond('No user found.'); let member = await message.guild.members.fetch(user.id).catch(console.error); - response = { - embed: { - title: `**${user.tag}** (${user.id})`, - description: stripIndents` - **Nickname:** ${member && member.nickname ? member.nickname : 'N/A'} - **User:** <@${user.id}> - **Server join date:** ${member && member.joinedAt ? member.joinedAt.toDateString() : 'N/A'} - **Account created:** ${user.createdAt.toDateString()} - **Status:** ${user.presence.status} - **Activity:** ${user.presence.activities.length > 0 ? user.presence.activities[0].name : 'N/A' } - **Last server activity:** ${member && member.lastMessage ? member.lastMessage.createdAt.toDateString() : 'N/A' } - **Last global activity:** ${user.lastMessage ? user.lastMessage.createdAt.toDateString() : 'N/A'} - ${member ? `**Roles:** ${member.roles.cache.filter(r=>r.name !== '@everyone').map(r=>r.name).join(', ')}` : '' } - `, - thumbnail: { - url: user.avatarURL() || user.defaultAvatarURL - } + response = message.format('C_USER', { + nickname: member && member.nickname ? member.nickname : 'N/A', + id: user.id, + joined: member && member.joinedAt ? member.joinedAt.toDateString() : 'N/A', + created: user.createdAt.toDateString(), + status: user.presence.status, + activity: user.presence.activities.length > 0 ? user.presence.activities[0].name : 'N/A', + serverActivity: member && member.lastMessage ? member.lastMessage.createdAt.toDateString() : 'N/A', + globalActivity: user.lastMessage ? user.lastMessage.createdAt.toDateString() : 'N/A', + roles: member ? member.roles.cache.filter(r => r.name !== '@everyone').map(r => r.name).join(', ') : 'N/A' + }); + + response = { + title: `**${user.tag}** (${user.id})`, + description: response, + thumbnail: { + url: user.avatarURL() || user.defaultAvatarURL } }; + } - return message.respond(response); + return message.embed(response); }