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,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) {

View file

@ -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) {

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");
});
});