Merge branch 'hotfix/0.5.2' into develop
All checks were successful
Deploy To Stage / build (push) Successful in 11s
Deploy To Stage / deploy (push) Successful in 16s

This commit is contained in:
Ethan Lane 2024-05-29 17:40:36 +01:00
commit e36ef85507
2 changed files with 5 additions and 9 deletions

2
.gitignore vendored
View file

@ -109,4 +109,4 @@ ormconfig.json
gdrive-credentials.json
data/
*.db
.temp/
.temp/

View file

@ -1,12 +1,10 @@
import { AttachmentBuilder, ButtonInteraction } from "discord.js";
import { 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";
@ -14,6 +12,8 @@ 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,17 +65,13 @@ 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.update({
await interaction.editReply({
embeds: [ embed ],
files: [ attachment ],
components: [ row ],
});
}