Fix embed not removing components after you run out
This commit is contained in:
parent
f98fecb774
commit
3c4f8b8099
1 changed files with 20 additions and 10 deletions
|
@ -75,7 +75,12 @@ export default class Multidrop extends ButtonEvent {
|
|||
.setDescription("Your multidrop has ran out! Please buy a new one!")
|
||||
.setColor(EmbedColours.Ok);
|
||||
|
||||
await interaction.update({ embeds: [ embed ]});
|
||||
await interaction.update({
|
||||
embeds: [ embed ],
|
||||
attachments: [],
|
||||
components: [],
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -92,7 +97,7 @@ export default class Multidrop extends ButtonEvent {
|
|||
await interaction.deferUpdate();
|
||||
|
||||
try {
|
||||
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", ));
|
||||
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
|
||||
const imageFileName = randomCard.card.path.split("/").pop()!;
|
||||
|
||||
const attachment = new AttachmentBuilder(image, { name: imageFileName });
|
||||
|
@ -104,7 +109,7 @@ export default class Multidrop extends ButtonEvent {
|
|||
|
||||
const row = CardDropHelperMetadata.GenerateMultidropButtons(randomCard, cardsRemaining, interaction.user.id, cardsRemaining < 0);
|
||||
|
||||
await interaction.update({
|
||||
await interaction.editReply({
|
||||
embeds: [ embed ],
|
||||
files: [ attachment ],
|
||||
components: [ row ],
|
||||
|
@ -112,7 +117,7 @@ export default class Multidrop extends ButtonEvent {
|
|||
} catch (e) {
|
||||
AppLogger.LogError("Button/Multidrop/Keep", `Error sending next drop for card ${randomCard.card.id}: ${e}`);
|
||||
|
||||
await interaction.reply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`);
|
||||
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +165,12 @@ export default class Multidrop extends ButtonEvent {
|
|||
.setDescription("Your multidrop has ran out! Please buy a new one!")
|
||||
.setColor(EmbedColours.Ok);
|
||||
|
||||
await interaction.update({ embeds: [ embed ]});
|
||||
await interaction.update({
|
||||
embeds: [ embed ],
|
||||
attachments: [],
|
||||
components: [],
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -169,7 +179,7 @@ export default class Multidrop extends ButtonEvent {
|
|||
cardsRemaining -= 1;
|
||||
|
||||
if (!randomCard) {
|
||||
AppLogger.LogWarn("Button/Multidrop/Keep", ErrorMessages.UnableToFetchCard);
|
||||
AppLogger.LogWarn("Button/Multidrop/Sacrifice", ErrorMessages.UnableToFetchCard);
|
||||
await interaction.reply(ErrorMessages.UnableToFetchCard);
|
||||
return;
|
||||
}
|
||||
|
@ -177,7 +187,7 @@ export default class Multidrop extends ButtonEvent {
|
|||
await interaction.deferUpdate();
|
||||
|
||||
try {
|
||||
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", ));
|
||||
const image = readFileSync(path.join(process.env.DATA_DIR!, "cards", randomCard.card.path));
|
||||
const imageFileName = randomCard.card.path.split("/").pop()!;
|
||||
|
||||
const attachment = new AttachmentBuilder(image, { name: imageFileName });
|
||||
|
@ -189,15 +199,15 @@ export default class Multidrop extends ButtonEvent {
|
|||
|
||||
const row = CardDropHelperMetadata.GenerateMultidropButtons(randomCard, cardsRemaining, interaction.user.id, cardsRemaining < 0);
|
||||
|
||||
await interaction.update({
|
||||
await interaction.editReply({
|
||||
embeds: [ embed ],
|
||||
files: [ attachment ],
|
||||
components: [ row ],
|
||||
});
|
||||
} catch (e) {
|
||||
AppLogger.LogError("Button/Multidrop/Keep", `Error sending next drop for card ${randomCard.card.id}: ${e}`);
|
||||
AppLogger.LogError("Button/Multidrop/Sacrifice", `Error sending next drop for card ${randomCard.card.id}: ${e}`);
|
||||
|
||||
await interaction.reply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`);
|
||||
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue