Compare commits
No commits in common. "04e5962a11d84d9aed1669882e7fc92f1280e091" and "62bcd6914c9f59c209b5cc1d03f52b9fa1d9b978" have entirely different histories.
04e5962a11
...
62bcd6914c
4 changed files with 8 additions and 49 deletions
|
@ -98,18 +98,10 @@ export default class Multidrop extends ButtonEvent {
|
||||||
await interaction.deferUpdate();
|
await interaction.deferUpdate();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const files = [];
|
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
|
||||||
let imageFileName = "";
|
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 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) {
|
||||||
|
|
|
@ -62,17 +62,10 @@ export default class Multidrop extends Command {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const files = [];
|
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
|
||||||
let imageFileName = "";
|
const imageFileName = randomCard.card.path.split("/").pop()!;
|
||||||
|
|
||||||
if (!(randomCard.card.path.startsWith("http://") || randomCard.card.path.startsWith("https://"))) {
|
const attachment = new AttachmentBuilder(image, { name: imageFileName });
|
||||||
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 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) {
|
||||||
|
|
|
@ -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");
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -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");
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Add table
Add a link
Reference in a new issue