Compare commits
3 commits
c6d78cc370
...
34ea1f87d7
Author | SHA1 | Date | |
---|---|---|---|
34ea1f87d7 | |||
ba9ade0659 | |||
297e34e1cf |
5 changed files with 9 additions and 12 deletions
|
@ -7,7 +7,7 @@
|
|||
# any secret values.
|
||||
|
||||
BOT_TOKEN=
|
||||
BOT_VER=0.5.0
|
||||
BOT_VER=0.5.2
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_OWNERID=147392775707426816
|
||||
BOT_CLIENTID=682942374040961060
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -108,4 +108,5 @@ config.json
|
|||
ormconfig.json
|
||||
gdrive-credentials.json
|
||||
data/
|
||||
.temp/
|
||||
*.db
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "card-drop",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "card-drop",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@discordjs/rest": "^2.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "card-drop",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"main": "./dist/bot.js",
|
||||
"typings": "./dist",
|
||||
"scripts": {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
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";
|
||||
|
||||
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];
|
||||
|
@ -52,17 +52,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 ],
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue