Fix event not checking if the user who clicked the button is the same user
Some checks failed
Test / build (push) Has been cancelled
Some checks failed
Test / build (push) Has been cancelled
This commit is contained in:
parent
2eedaec2e3
commit
791bd6d2a6
1 changed files with 10 additions and 0 deletions
|
@ -24,6 +24,11 @@ export default class Sacrifice extends ButtonEvent {
|
||||||
const userId = interaction.customId.split(" ")[2];
|
const userId = interaction.customId.split(" ")[2];
|
||||||
const cardNumber = interaction.customId.split(" ")[3];
|
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);
|
const cardInInventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
|
||||||
|
|
||||||
if (!cardInInventory) {
|
if (!cardInInventory) {
|
||||||
|
@ -94,6 +99,11 @@ export default class Sacrifice extends ButtonEvent {
|
||||||
const userId = interaction.customId.split(" ")[2];
|
const userId = interaction.customId.split(" ")[2];
|
||||||
const cardNumber = interaction.customId.split(" ")[3];
|
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);
|
const cardInInventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
|
||||||
|
|
||||||
if (!cardInInventory) {
|
if (!cardInInventory) {
|
||||||
|
|
Loading…
Reference in a new issue