getloot results are now stored in the database, use lootbox triggers getloot

This commit is contained in:
2025-09-15 13:40:05 +02:00
parent f8fb2c0317
commit 8284d79c5f
4 changed files with 31 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import { buildTimeString } from "lib/dateManager";
import { timeout } from "lib/timeout";
import { isInvuln, removeInvuln } from "lib/invuln";
import { streamerUsers } from "main";
import { createGetLootRecord } from "db/dbGetLoot";
const COOLDOWN = 10 * 60 * 1000; // 10 mins (ms)
@@ -79,6 +80,7 @@ export default new Command({
await Promise.all([
updateUserRecord(user, userData),
sendMessage(message, msg.messageId),
createGetLootRecord(user, gainedqbucks, itemDiff),
user.clearLock()
]);
}

View File

@@ -3,6 +3,7 @@ import { Command, sendMessage } from "commands";
import items from "items";
import { isInvuln, removeInvuln } from "lib/invuln";
import { streamerUsers } from "main";
import getloot from "./getloot";
export default new Command({
name: 'use',
@@ -13,6 +14,7 @@ export default new Command({
const messagequery = msg.messageText.trim().split(' ').slice(1);
if (!messagequery[0]) { await sendMessage('Please specify an item you would like to use', msg.messageId); return; };
const selection = items.get(messagequery[0].toLowerCase());
if (messagequery[0].toLowerCase() === "lootbox") { await getloot.execute(msg, user); return; };
if (!selection) { await sendMessage(`'${messagequery[0]}' is not an item`, msg.messageId); return; };
if (await redis.sismember('disabledcommands', selection.name)) { await sendMessage(`The ${selection.prettyName} item is disabled`, msg.messageId); return; };
if (await isInvuln(msg.chatterId) && !streamerUsers.includes(msg.chatterId)) { await sendMessage(`You're no longer an invuln because you used an item.`, msg.messageId); await removeInvuln(msg.chatterId); };