Compare commits

..

No commits in common. "04e5962a11d84d9aed1669882e7fc92f1280e091" and "62bcd6914c9f59c209b5cc1d03f52b9fa1d9b978" have entirely different histories.

4 changed files with 8 additions and 49 deletions

View file

@ -98,19 +98,11 @@ export default class Multidrop extends ButtonEvent {
await interaction.deferUpdate(); await interaction.deferUpdate();
try { try {
const files = [];
let imageFileName = "";
if (!(randomCard.card.path.startsWith("http://") || randomCard.card.path.startsWith("https://"))) {
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
const attachment = new AttachmentBuilder(image, { name: imageFileName }); const attachment = new AttachmentBuilder(image, { name: imageFileName });
files.push(attachment);
}
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id); const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id);
const quantityClaimed = inventory ? inventory.Quantity : 0; const quantityClaimed = inventory ? inventory.Quantity : 0;
@ -120,7 +112,7 @@ export default class Multidrop extends ButtonEvent {
await interaction.editReply({ await interaction.editReply({
embeds: [ embed ], embeds: [ embed ],
files: files, files: [ attachment ],
components: [ row ], components: [ row ],
}); });
} catch (e) { } catch (e) {

View file

@ -62,18 +62,11 @@ export default class Multidrop extends Command {
await interaction.deferReply(); await interaction.deferReply();
try { try {
const files = [];
let imageFileName = "";
if (!(randomCard.card.path.startsWith("http://") || randomCard.card.path.startsWith("https://"))) {
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
const attachment = new AttachmentBuilder(image, { name: imageFileName }); const attachment = new AttachmentBuilder(image, { name: imageFileName });
files.push(attachment);
}
const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id); const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id);
const quantityClaimed = inventory ? inventory.Quantity : 0; const quantityClaimed = inventory ? inventory.Quantity : 0;
@ -83,7 +76,7 @@ export default class Multidrop extends Command {
await interaction.editReply({ await interaction.editReply({
embeds: [ embed ], embeds: [ embed ],
files: files, files: [ attachment ],
components: [ row ], components: [ row ],
}); });
} catch (e) { } catch (e) {

View file

@ -1,13 +0,0 @@
describe("execute", () => {
describe("GIVEN randomCard image is hosted locally", () => {
test.todo("EXPECT image to be uploaded directly");
});
describe("GIVEN randomCard image is hosted via http", () => {
test.todo("EXPECT image link to be directly added to embed");
});
describe("GIVEN randomCard image is hosted via https", () => {
test.todo("EXPECT image link to be directly added to embed");
});
});

View file

@ -1,13 +0,0 @@
describe("execute", () => {
describe("GIVEN randomCard image is hosted locally", () => {
test.todo("EXPECT image to be uploaded directly");
});
describe("GIVEN randomCard image is hosted via http", () => {
test.todo("EXPECT image link to be directly added to embed");
});
describe("GIVEN randomCard image is hosted via https", () => {
test.todo("EXPECT image link to be directly added to embed");
});
});