1
0
Fork 0

fix get referral

refactor/models
Matthew 2020-08-28 02:55:29 -04:00
parent 2c46db176f
commit 99fa3b38bd
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ export default class AddReferral extends Command {
public async run(message: Message, args: string[]) { // eslint-disable-line public async run(message: Message, args: string[]) { // eslint-disable-line
try { try {
if (!args.length) return this.client.commands.get('help').run(message, [this.name]); if (!args.length) return this.client.commands.get('help').run(message, [this.name]);
const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] }); const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { referralCode: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] });
if (!account) return this.error(message.channel, 'Cannot find user.'); if (!account) return this.error(message.channel, 'Cannot find user.');
await account.updateOne({ $inc: { totalReferrals: 1 } }); await account.updateOne({ $inc: { totalReferrals: 1 } });