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,13 +38,11 @@ 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}`
}
} }
}; };
@ -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 = { response = message.format('C_USER', {
embed: { nickname: member && member.nickname ? member.nickname : 'N/A',
title: `**${user.tag}** (${user.id})`, id: user.id,
description: stripIndents` joined: member && member.joinedAt ? member.joinedAt.toDateString() : 'N/A',
**Nickname:** ${member && member.nickname ? member.nickname : 'N/A'} created: user.createdAt.toDateString(),
**User:** <@${user.id}> status: user.presence.status,
**Server join date:** ${member && member.joinedAt ? member.joinedAt.toDateString() : 'N/A'} activity: user.presence.activities.length > 0 ? user.presence.activities[0].name : 'N/A',
**Account created:** ${user.createdAt.toDateString()} serverActivity: member && member.lastMessage ? member.lastMessage.createdAt.toDateString() : 'N/A',
**Status:** ${user.presence.status} globalActivity: user.lastMessage ? user.lastMessage.createdAt.toDateString() : 'N/A',
**Activity:** ${user.presence.activities.length > 0 ? user.presence.activities[0].name : 'N/A' } roles: member ? member.roles.cache.filter(r => r.name !== '@everyone').map(r => r.name).join(', ') : '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(', ')}` : '' } response = {
`, title: `**${user.tag}** (${user.id})`,
thumbnail: { description: response,
url: user.avatarURL() || user.defaultAvatarURL thumbnail: {
} url: user.avatarURL() || user.defaultAvatarURL
} }
}; };
} }
return message.respond(response); return message.embed(response);
} }