fix issues with score notification

pull/29/head
Matthew 2020-09-10 02:08:41 -04:00
parent 6d1671daef
commit 2e6f494c79
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 16 additions and 15 deletions

View File

@ -16,9 +16,8 @@ export default class Score extends Command {
public async run(message: Message, args: string[]) {
try {
let member: Member;
if (!args[0] || !this.checkCustomPermissions(message.member, 2)) {
member = message.member;
if (args[0] === 'notify') {
member = message.member;
const score = await this.client.db.Score.findOne({ userID: message.author.id });
if (!score) return this.error(message.channel, 'Score not calculated yet.');
if (!score.notify) await this.client.db.Score.updateOne({ userID: message.author.id }, { $set: { notify: false } });
@ -33,6 +32,8 @@ export default class Score extends Command {
return this.error(message.channel, 'Invalid option. Valid options are `yes` and `no`.');
}
}
if (!args[0] || !this.checkCustomPermissions(message.member, 2)) {
member = message.member;
} else {
member = this.client.util.resolveMember(args[0], this.mainGuild);
if (args[1] === 'hard') {