mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 08:41:39 +01:00
forgot to add itemlock verification to give commands
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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([
|
||||
|
||||
Reference in New Issue
Block a user