1
0
Fork 0

add tier information and perm cleanup for whois commands

refactor/models
Matthew 2020-03-23 22:27:00 -04:00
parent fbe5037630
commit 0a2ad6cdde
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
2 changed files with 8 additions and 8 deletions

View File

@ -38,6 +38,7 @@ export default class Whois extends Command {
embed.addField('Username', `${account.username} | <@${account.userID}>`, true); embed.addField('Username', `${account.username} | <@${account.userID}>`, true);
embed.addField('ID', account.userID, true); embed.addField('ID', account.userID, true);
embed.addField('Email Address', account.emailAddress, true); embed.addField('Email Address', account.emailAddress, true);
embed.addField('Tier', String(account.tier), true);
embed.addField('Created By', `<@${this.client.users.get(account.createdBy).id}>`, true); embed.addField('Created By', `<@${this.client.users.get(account.createdBy).id}>`, true);
embed.addField('Created At', moment(account.createdAt).format('dddd, MMMM Do YYYY, h:mm:ss A'), true); embed.addField('Created At', moment(account.createdAt).format('dddd, MMMM Do YYYY, h:mm:ss A'), true);
const cpuUsage = await this.client.util.exec(`top -b -n 1 -u ${account.username} | awk 'NR>7 { sum += $9; } END { print sum; }'`); const cpuUsage = await this.client.util.exec(`top -b -n 1 -u ${account.username} | awk 'NR>7 { sum += $9; } END { print sum; }'`);
@ -47,10 +48,9 @@ export default class Whois extends Command {
embed.addField('Storage', data, true); embed.addField('Storage', data, true);
let details = ''; let details = '';
if (account.locked) details += 'This account is currently locked.\n'; if (account.locked) details += 'This account is currently locked.\n';
if (account.permissions.engineer) details += 'This account belongs to an Engineer.\n'; if (account.permissions.facultyMarshal) details += 'This account belongs to a Faculty Marshal.\n';
else if (account.permissions.communityManager) details += 'This account belongs to a Community Manager.\n'; else if (account.permissions.sheriff) details += 'This account belongs to a Sheriff.\n';
else if (account.permissions.supervisor) details += 'This account belongs to a Supervisor.\n'; else if (account.permissions.associate) details += 'This account belongs to a Staff member.\n';
else if (account.permissions.staff) details += 'This account belongs to a Staff member.\n';
if (account.root) details += 'This account has root/administrative privileges.\n'; if (account.root) details += 'This account has root/administrative privileges.\n';
if (details) embed.addField('Additional Details', details, true); if (details) embed.addField('Additional Details', details, true);
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);

View File

@ -27,6 +27,7 @@ export default class Whois_User extends Command {
embed.setColor(0x36393f); embed.setColor(0x36393f);
embed.addField('Username', `${account.username} | <@${account.userID}>`, true); embed.addField('Username', `${account.username} | <@${account.userID}>`, true);
embed.addField('ID', account.userID, true); embed.addField('ID', account.userID, true);
embed.addField('Tier', String(account.tier), true);
embed.addField('Created By', `<@${this.client.users.get(account.createdBy).id}>`, true); embed.addField('Created By', `<@${this.client.users.get(account.createdBy).id}>`, true);
embed.addField('Created At', moment(account.createdAt).format('dddd, MMMM Do YYYY, h:mm:ss A'), true); embed.addField('Created At', moment(account.createdAt).format('dddd, MMMM Do YYYY, h:mm:ss A'), true);
const cpuUsage = await this.client.util.exec(`top -b -n 1 -u ${account.username} | awk 'NR>7 { sum += $9; } END { print sum; }'`); const cpuUsage = await this.client.util.exec(`top -b -n 1 -u ${account.username} | awk 'NR>7 { sum += $9; } END { print sum; }'`);
@ -36,10 +37,9 @@ export default class Whois_User extends Command {
embed.addField('Storage', data, true); embed.addField('Storage', data, true);
let details = ''; let details = '';
if (account.locked) details += 'This account is currently locked.\n'; if (account.locked) details += 'This account is currently locked.\n';
if (account.permissions.engineer) details += 'This account belongs to an Engineer.\n'; if (account.permissions.facultyMarshal) details += 'This account belongs to a Faculty Marshal.\n';
else if (account.permissions.communityManager) details += 'This account belongs to a Community Manager.\n'; else if (account.permissions.sheriff) details += 'This account belongs to a Sheriff.\n';
else if (account.permissions.supervisor) details += 'This account belongs to a Supervisor.\n'; else if (account.permissions.associate) details += 'This account belongs to a Staff member.\n';
else if (account.permissions.staff) details += 'This account belongs to a Staff member.\n';
if (account.root) details += 'This account has root/administrative privileges.\n'; if (account.root) details += 'This account has root/administrative privileges.\n';
if (details) embed.addField('Additional Details', details, true); if (details) embed.addField('Additional Details', details, true);
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);