From 61ba81d850d846d7e65dd14d62da65dc3ca5c1f3 Mon Sep 17 00:00:00 2001 From: qwerinope Date: Fri, 27 Jun 2025 12:34:54 +0200 Subject: [PATCH] forgot to add itemlock verification to give commands --- bot/commands/admingive.ts | 1 + bot/commands/give.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/bot/commands/admingive.ts b/bot/commands/admingive.ts index b5f53da..7920cdc 100644 --- a/bot/commands/admingive.ts +++ b/bot/commands/admingive.ts @@ -18,6 +18,7 @@ export default new Command('admingive', ['admingive'], [], async msg => { if (!args[2]) { await sendMessage('Please specify the amount of the item you want to give', msg.messageId); return; }; const amount = Number(args[2]); if (isNaN(amount)) { await sendMessage(`${args[2]} is not a valid amount`); return; }; + if (await target.itemLock()) { await sendMessage('Cannot give item: item transaction in progress', msg.messageId); return; }; await target.setLock(); const data = await changeItemCount(target, userRecord, item.name, amount); if (data) { diff --git a/bot/commands/give.ts b/bot/commands/give.ts index f7c0e5f..0412cda 100644 --- a/bot/commands/give.ts +++ b/bot/commands/give.ts @@ -21,6 +21,7 @@ export default new Command('give', ['give'], [], async (msg, user) => { const userRecord = await getUserRecord(user); if (userRecord.inventory[item.name]! < amount) { await sendMessage(`You can't give items you don't have!`, msg.messageId); return; }; + if (await user.itemLock() || await target.itemLock()) { await sendMessage('Cannot give item. Please try again!', msg.messageId); return; }; await user.setLock(); await target.setLock(); const data = await Promise.all([