Fix dropnumber command (#109)
All checks were successful
continuous-integration/drone/push Build is passing

# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Fix the dropnumber command

#108

## Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/109
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
Ethan Lane 2023-12-09 17:18:53 +00:00 committed by Vylpes
parent be7a7c4ca4
commit 9929799151

View file

@ -31,20 +31,18 @@ export default class Dropnumber extends Command {
return; return;
} }
const series = CoreClient.Cards.find(x => x.cards.find(y => y.id == cardNumber.toString())); const card = CoreClient.Cards
.flatMap(x => x.cards)
if (!series) { .find(x => x.id == cardNumber.value);
await interaction.reply('Card not found');
return;
}
const card = series.cards.find(x => x.id == cardNumber.toString());
if (!card) { if (!card) {
await interaction.reply('Card not found'); await interaction.reply('Card not found');
return; return;
} }
const series = CoreClient.Cards
.find(x => x.cards.includes(card))!;
let image: Buffer; let image: Buffer;
const imageFileName = card.path.split("/").pop()!; const imageFileName = card.path.split("/").pop()!;