Update claim event to defer the reply
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
891e013e37
commit
88339d0a43
3 changed files with 9 additions and 7 deletions
|
@ -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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,9 +27,9 @@ export default class Reroll extends ButtonEvent {
|
||||||
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()!;
|
||||||
|
|
||||||
|
|
|
@ -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()!;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue