Fix event not checking if the user who clicked the button is the same user
Some checks failed
Test / build (push) Has been cancelled

This commit is contained in:
Ethan Lane 2024-05-23 17:59:52 +01:00
parent 2eedaec2e3
commit 791bd6d2a6

View file

@ -24,6 +24,11 @@ export default class Sacrifice extends ButtonEvent {
const userId = interaction.customId.split(" ")[2];
const cardNumber = interaction.customId.split(" ")[3];
if (userId != interaction.user.id) {
await interaction.reply("Only the user who created this sacrifice can confirm it.");
return;
}
const cardInInventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
if (!cardInInventory) {
@ -94,6 +99,11 @@ export default class Sacrifice extends ButtonEvent {
const userId = interaction.customId.split(" ")[2];
const cardNumber = interaction.customId.split(" ")[3];
if (userId != interaction.user.id) {
await interaction.reply("Only the user who created this sacrifice can cancel it.");
return;
}
const cardInInventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
if (!cardInInventory) {