diff --git a/src/commands/score_hist.ts b/src/commands/score_hist.ts index 7a6af68..9d08269 100644 --- a/src/commands/score_hist.ts +++ b/src/commands/score_hist.ts @@ -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();