reformat to fit templating, needs some work still

This commit is contained in:
Erik 2020-04-19 22:53:36 +03:00
parent 23c75290c7
commit d971e126db

View File

@ -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 search = params[0] ? params[0].toLowerCase() === 'search' : false;
let response = ''; let response = '';
if(search && params.length > 1) { if(search && params.length > 1) {
@ -39,14 +38,12 @@ class UserCommand extends Command {
} }
response = { response = {
embed: {
description: response, description: response,
title: `Search result for keyword: \`${key}\``, title: `Search result for keyword: \`${key}\``,
color: 0x0088cc, color: 0x0088cc,
footer: { footer: {
text: `Found ${members.size} matches, displaying ${count}` text: `Found ${members.size} matches, displaying ${count}`
} }
}
}; };
} else { } else {
@ -55,28 +52,29 @@ class UserCommand extends Command {
if(!user) return message.respond('No user found.'); if(!user) return message.respond('No user found.');
let member = await message.guild.members.fetch(user.id).catch(console.error); let member = await message.guild.members.fetch(user.id).catch(console.error);
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 = { response = {
embed: {
title: `**${user.tag}** (${user.id})`, title: `**${user.tag}** (${user.id})`,
description: stripIndents` description: response,
**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: { thumbnail: {
url: user.avatarURL() || user.defaultAvatarURL url: user.avatarURL() || user.defaultAvatarURL
} }
}
}; };
} }
return message.respond(response); return message.embed(response);
} }