ReplyUtils: Make component recreation compatible with multi-row components

This commit is contained in:
2023-04-05 16:47:13 +02:00
parent 4b598cadbf
commit a1c9f9f32e
2 changed files with 8 additions and 6 deletions

View File

@@ -191,12 +191,12 @@ module.exports = {
});
let reply = await i.reply({ content: `${i.user} (${claimUser.id}) claimed a card! [${cards[cardId].identifier}]`, ephemeral: false, fetchReply: true });
collectionReplies.push({ ref: reply, characterName: character.name, card: cards[cardId] });
let newRow = ReplyUtils.recreateComponents(i.message.components);
newRow.components[cardId].setLabel("Claimed");
newRow.components[cardId].setStyle(ButtonStyle.Success);
newRow.components[cardId].setDisabled(true);
let newComponents = ReplyUtils.recreateComponents(i.message.components);
newComponents[0].components[cardId].setLabel("Claimed");
newComponents[0].components[cardId].setStyle(ButtonStyle.Success);
newComponents[0].components[cardId].setDisabled(true);
//let deckImage = await Rendering.renderCardStack(cards);
message.edit({ components: [newRow] });
message.edit({ components: newComponents });
}
});