Compare commits
No commits in common. "e36ef855077d2fe9dab76873e7457980ecaf0d21" and "318b07e2066980c244e3fd7f4be1b6890d93213b" have entirely different histories.
e36ef85507
...
318b07e206
2 changed files with 9 additions and 5 deletions
|
@ -1,10 +1,12 @@
|
|||
import { ButtonInteraction } from "discord.js";
|
||||
import { AttachmentBuilder, ButtonInteraction } from "discord.js";
|
||||
import { ButtonEvent } from "../type/buttonEvent";
|
||||
import Inventory from "../database/entities/app/Inventory";
|
||||
import { CoreClient } from "../client/client";
|
||||
import { default as eClaim } from "../database/entities/app/Claim";
|
||||
import AppLogger from "../client/appLogger";
|
||||
import CardDropHelperMetadata from "../helpers/CardDropHelperMetadata";
|
||||
import { readFileSync } from "fs";
|
||||
import path from "path";
|
||||
import User from "../database/entities/app/User";
|
||||
import CardConstants from "../constants/CardConstants";
|
||||
|
||||
|
@ -12,8 +14,6 @@ export default class Claim extends ButtonEvent {
|
|||
public override async execute(interaction: ButtonInteraction) {
|
||||
if (!interaction.guild || !interaction.guildId) return;
|
||||
|
||||
await interaction.deferUpdate();
|
||||
|
||||
const cardNumber = interaction.customId.split(" ")[1];
|
||||
const claimId = interaction.customId.split(" ")[2];
|
||||
const droppedBy = interaction.customId.split(" ")[3];
|
||||
|
@ -65,13 +65,17 @@ export default class Claim extends ButtonEvent {
|
|||
return;
|
||||
}
|
||||
|
||||
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", card.card.path));
|
||||
const imageFileName = card.card.path.split("/").pop()!;
|
||||
|
||||
const attachment = new AttachmentBuilder(image, { name: imageFileName });
|
||||
|
||||
const embed = CardDropHelperMetadata.GenerateDropEmbed(card, inventory.Quantity, imageFileName, interaction.user.username);
|
||||
const row = CardDropHelperMetadata.GenerateDropButtons(card, claimId, interaction.user.id, true);
|
||||
|
||||
await interaction.editReply({
|
||||
await interaction.update({
|
||||
embeds: [ embed ],
|
||||
files: [ attachment ],
|
||||
components: [ row ],
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue