From b8ff7aa494735cec639aa98578c52cbdd3ccd741 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Wed, 6 May 2020 19:33:05 -0400 Subject: [PATCH] fix issue with additem --- src/commands/additem.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/additem.ts b/src/commands/additem.ts index b8f35a5..05073bf 100644 --- a/src/commands/additem.ts +++ b/src/commands/additem.ts @@ -33,8 +33,9 @@ export default class AddItem extends Command { }, }); await newAccount.save(); + } else { + await account.updateOne({ $addToSet: { 'additional.operatingSystems': args[0].split('-')[1] } }); } - await account.updateOne({ $addToSet: { 'additional.operatingSystems': args[0].split('-')[1] } }); return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Added OS code ${args[0]} to profile.***`); } if (args[0].split('-')[0] === 'lang' && ['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'].includes(args[0].split('-')[1])) { @@ -48,8 +49,9 @@ export default class AddItem extends Command { }, }); await newAccount.save(); + } else { + await account.updateOne({ $addToSet: { 'additional.langs': args[0].split('-')[1] } }); } - await account.updateOne({ $addToSet: { 'additional.langs': args[0].split('-')[1] } }); return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Added language code ${args[0]} to profile.***`); } return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Invalid data code.***`);