Skip to content

Commit

Permalink
fix: promocode list errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno authored Jun 28, 2018
1 parent 7043b4e commit 28cda5f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/commands/Promocodes/ListClaimed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down

0 comments on commit 28cda5f

Please sign in to comment.