fix issues with score notification
parent
6d1671daef
commit
2e6f494c79
|
@ -16,9 +16,8 @@ export default class Score extends Command {
|
||||||
public async run(message: Message, args: string[]) {
|
public async run(message: Message, args: string[]) {
|
||||||
try {
|
try {
|
||||||
let member: Member;
|
let member: Member;
|
||||||
if (!args[0] || !this.checkCustomPermissions(message.member, 2)) {
|
|
||||||
member = message.member;
|
|
||||||
if (args[0] === 'notify') {
|
if (args[0] === 'notify') {
|
||||||
|
member = message.member;
|
||||||
const score = await this.client.db.Score.findOne({ userID: message.author.id });
|
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) 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 } });
|
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`.');
|
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 {
|
} else {
|
||||||
member = this.client.util.resolveMember(args[0], this.mainGuild);
|
member = this.client.util.resolveMember(args[0], this.mainGuild);
|
||||||
if (args[1] === 'hard') {
|
if (args[1] === 'hard') {
|
||||||
|
|
Loading…
Reference in New Issue