move itemuses to a seperate table, finish !stats implementation

This commit is contained in:
2025-04-05 19:27:12 +02:00
parent 5b5886e3a1
commit 3bd2cb1038
4 changed files with 108 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
import { HelixUser } from "@twurple/api"
import { changeBalance, getInventory, updateInventory } from "../lib/userHelper"
import { addUsedItem, changeBalance, getInventory, updateInventory } from "../lib/userHelper"
import { timeout, addTimeoutToDB, vulnerableUsers } from "./timeoutHelper"
import api, { broadcasterApi } from "./api"
@@ -22,6 +22,7 @@ export async function changeItemCount(user: HelixUser, item: string, amount = -1
value: newcount,
})
await updateInventory(user, inv)
await addUsedItem(user, item)
return { result: true, reason: '', count: inv[item] }
}