Compare commits

...

4 commits

Author SHA1 Message Date
Ethan Lane 6c00594085 0.4.2 2024-01-21 14:16:23 +00:00
Ethan Lane 25b64df8e9 0.4.2 2024-01-21 14:16:04 +00:00
Ethan Lane 88339d0a43 Update claim event to defer the reply
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-21 14:13:41 +00:00
Ethan Lane 891e013e37 Move defer reply on reroll command 2024-01-21 13:40:06 +00:00
8 changed files with 15 additions and 13 deletions

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.4.1 BOT_VER=0.4.2
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060 BOT_CLIENTID=682942374040961060

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.4.1 BOT_VER=0.4.2
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=1093810443589529631 BOT_CLIENTID=1093810443589529631

View file

@ -7,7 +7,7 @@
# any secret values. # any secret values.
BOT_TOKEN= BOT_TOKEN=
BOT_VER=0.4.1 BOT_VER=0.4.2
BOT_AUTHOR=Vylpes BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816 BOT_OWNERID=147392775707426816
BOT_CLIENTID=1147976642942214235 BOT_CLIENTID=1147976642942214235

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "card-drop", "name": "card-drop",
"version": "0.4.1", "version": "0.4.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "card-drop", "name": "card-drop",
"version": "0.4.1", "version": "0.4.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@discordjs/rest": "^2.0.0", "@discordjs/rest": "^2.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "card-drop", "name": "card-drop",
"version": "0.4.1", "version": "0.4.2",
"main": "./dist/bot.js", "main": "./dist/bot.js",
"typings": "./dist", "typings": "./dist",
"scripts": { "scripts": {

View file

@ -13,15 +13,17 @@ export default class Claim extends ButtonEvent {
const droppedBy = interaction.customId.split(" ")[3]; const droppedBy = interaction.customId.split(" ")[3];
const userId = interaction.user.id; const userId = interaction.user.id;
await interaction.deferReply();
const claimed = await eClaim.FetchOneByClaimId(claimId); const claimed = await eClaim.FetchOneByClaimId(claimId);
if (claimed) { if (claimed) {
await interaction.reply("This card has already been claimed"); await interaction.editReply("This card has already been claimed");
return; return;
} }
if (claimId == CoreClient.ClaimId && userId != droppedBy) { if (claimId == CoreClient.ClaimId && userId != droppedBy) {
await interaction.reply("The latest dropped card can only be claimed by the user who dropped it"); await interaction.editReply("The latest dropped card can only be claimed by the user who dropped it");
return; return;
} }
@ -40,6 +42,6 @@ export default class Claim extends ButtonEvent {
await claim.Save(eClaim, claim); await claim.Save(eClaim, claim);
await interaction.reply(`Card claimed by ${interaction.user}`); await interaction.editReply(`Card claimed by ${interaction.user}`);
} }
} }

View file

@ -27,12 +27,12 @@ export default class Reroll extends ButtonEvent {
return; return;
} }
await interaction.deferReply();
try { try {
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;
await interaction.deferReply();
const attachment = new AttachmentBuilder(image, { name: imageFileName }); 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);

View file

@ -35,9 +35,9 @@ export default class Drop extends Command {
return; return;
} }
try { await interaction.deferReply();
await interaction.deferReply();
try {
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path)); const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
const imageFileName = randomCard.card.path.split("/").pop()!; const imageFileName = randomCard.card.path.split("/").pop()!;