1
0
Fork 0

push changes to fix query in lock/unlock

refactor/models
Matthew 2019-10-27 23:38:23 -04:00
parent 353a4d8137
commit a263b91551
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ export default class Lock 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: [{ account: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] }); const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] });
if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`); if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`);
if (account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already locked.***`); if (account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already locked.***`);
const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`); const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`);

View File

@ -15,7 +15,7 @@ export default class Unlock 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: [{ account: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] }); const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] });
if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`); if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`);
if (!account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already unlocked.***`); if (!account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already unlocked.***`);
const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Unlocking account...***`); const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Unlocking account...***`);