forked from engineering/cloudservices
fix get referral
parent
2c46db176f
commit
99fa3b38bd
|
@ -15,7 +15,7 @@ export default class AddReferral extends Command {
|
|||
public async run(message: Message, args: string[]) { // eslint-disable-line
|
||||
try {
|
||||
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.');
|
||||
|
||||
await account.updateOne({ $inc: { totalReferrals: 1 } });
|
||||
|
|
Loading…
Reference in New Issue