diff --git a/src/buttonEvents/Multidrop.ts b/src/buttonEvents/Multidrop.ts index e88d6ef..e6ea7c2 100644 --- a/src/buttonEvents/Multidrop.ts +++ b/src/buttonEvents/Multidrop.ts @@ -98,18 +98,10 @@ export default class Multidrop extends ButtonEvent { await interaction.deferUpdate(); 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)); - imageFileName = randomCard.card.path.split("/").pop()!; - - const attachment = new AttachmentBuilder(image, { name: imageFileName }); - - files.push(attachment); - } + const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); + const imageFileName = randomCard.card.path.split("/").pop()!; + const attachment = new AttachmentBuilder(image, { name: imageFileName }); const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id); const quantityClaimed = inventory ? inventory.Quantity : 0; @@ -120,7 +112,7 @@ export default class Multidrop extends ButtonEvent { await interaction.editReply({ embeds: [ embed ], - files: files, + files: [ attachment ], components: [ row ], }); } catch (e) { diff --git a/src/commands/multidrop.ts b/src/commands/multidrop.ts index 82d19fe..aa42686 100644 --- a/src/commands/multidrop.ts +++ b/src/commands/multidrop.ts @@ -62,17 +62,10 @@ export default class Multidrop extends Command { await interaction.deferReply(); try { - const files = []; - let imageFileName = ""; + const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); + const imageFileName = randomCard.card.path.split("/").pop()!; - if (!(randomCard.card.path.startsWith("http://") || randomCard.card.path.startsWith("https://"))) { - const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); - imageFileName = randomCard.card.path.split("/").pop()!; - - const attachment = new AttachmentBuilder(image, { name: imageFileName }); - - files.push(attachment); - } + const attachment = new AttachmentBuilder(image, { name: imageFileName }); const inventory = await Inventory.FetchOneByCardNumberAndUserId(interaction.user.id, randomCard.card.id); const quantityClaimed = inventory ? inventory.Quantity : 0; @@ -83,7 +76,7 @@ export default class Multidrop extends Command { await interaction.editReply({ embeds: [ embed ], - files: files, + files: [ attachment ], components: [ row ], }); } catch (e) { diff --git a/tests/buttonEvents/Multidrop.test.ts b/tests/buttonEvents/Multidrop.test.ts deleted file mode 100644 index 5c9da42..0000000 --- a/tests/buttonEvents/Multidrop.test.ts +++ /dev/null @@ -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"); - }); -}); diff --git a/tests/commands/multidrop.test.ts b/tests/commands/multidrop.test.ts deleted file mode 100644 index 5c9da42..0000000 --- a/tests/commands/multidrop.test.ts +++ /dev/null @@ -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"); - }); -});