fixes last

master
Matthew 2021-07-08 17:30:05 -04:00
parent c3d32dbc76
commit d926a4aba1
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 14 additions and 9 deletions

View File

@ -20,13 +20,24 @@ export default class Score_Hist extends Command {
public async run(message: Message, args: string[]) {
try {
let user: User;
if (!this.checkCustomPermissions(message.member, 4)) user = message.author;
else if (!args[0]) user = message.author;
else {
if (!this.checkCustomPermissions(message.member, 4)) {
user = message.author;
await this.client.report.createInquiry(user.id, `${user.username}#${user.discriminator} VIA DISCORD - [HISTORICAL]`, 1);
} else if (!args[0]) {
user = message.author;
await this.client.report.createInquiry(user.id, `${user.username}#${user.discriminator} VIA DISCORD - [HISTORICAL]`, 1);
} else {
user = this.client.util.resolveMember(args[0], this.mainGuild)?.user;
if (!user) {
const sc = await this.client.db.Score.findOne({ pin: [Number(args[0].split('-')[0]), Number(args[0].split('-')[1]), Number(args[0].split('-')[2])] });
user = this.client.util.resolveMember(sc.userID, this.mainGuild)?.user;
let name = '';
for (const role of this.client.util.resolveMember(message.author.id, this.mainGuild).roles.map((r) => this.mainGuild.roles.get(r)).sort((a, b) => b.position - a.position)) {
name = `Library of Code sp-us | ${role.name} - [HISTORICAL]`;
break;
}
await this.client.report.createInquiry(user.id, name, 1);
}
}
if (!user) return this.error(message.channel, 'Member not found.');
@ -105,12 +116,6 @@ export default class Score_Hist extends Command {
else if (stat.cloudServicesMean > 10) cloudServicesMean = '10';
else cloudServicesMean = `${stat.cloudServicesMean}`;
let name = '';
for (const role of this.client.util.resolveMember(message.author.id, this.mainGuild).roles.map((r) => this.mainGuild.roles.get(r)).sort((a, b) => b.position - a.position)) {
name = `Library of Code sp-us | ${role.name} - [HISTORICAL]`;
break;
}
await this.client.report.createInquiry(user.id, name, 1);
const embed = new RichEmbed();