From 28cda5fad0998843f73fa88d6acc8c60920b9c48 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Thu, 28 Jun 2018 11:02:23 -0500 Subject: [PATCH] fix: promocode list errors --- src/commands/Promocodes/ListClaimed.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/commands/Promocodes/ListClaimed.js b/src/commands/Promocodes/ListClaimed.js index f528791cf..2cb91fcb3 100644 --- a/src/commands/Promocodes/ListClaimed.js +++ b/src/commands/Promocodes/ListClaimed.js @@ -16,19 +16,20 @@ class ListClaimed extends Command { } const codes = await this.settings.getUserCodes(message.author); const groupCodes = createGroupedArray(codes, 27); - const metaCodes = createGroupedArray(groupCodes, 4); const pages = []; - - metaCodes.forEach((codeGroup) => { + groupCodes.forEach((codeGroup) => { const embed = { title: 'Claimed Codes', color: 0xd30000, - fields: codes.length === 0 + fields: codeGroup.length === 0 ? [{ name: '_ _', value: 'No claimed codes' }] - : codeGroup.map(code => ({ - name: `${code.pool_name} • ${code.platform.toUpperCase()}`, - value: `\`\`\`\n${code.code}\`\`\`\n[Claim](https://warframe.com/promocodes?code=${code.code})`, - })), + : codeGroup.map(code => { + this.logger.error(JSON.stringify(code)); + return { + name: `${code.pool_name} • ${(code.platform || 'pc').toUpperCase()}`, + value: `\`${code.code}\`\n[Claim](https://warframe.com/promocode?code=${code.code})`, + }; + }), }; pages.push(embed); });