add inventory, give and admingive commands. Handle user records in database and minor bugfixes

This commit is contained in:
2025-06-27 12:14:34 +02:00
parent 274b49dd27
commit fa7c45042d
10 changed files with 187 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
import type { AccessToken } from "@twurple/auth";
import PocketBase, { RecordService } from "pocketbase";
import type { inventory } from "../items";
const pocketbaseurl = process.env.POCKETBASE_URL ?? "localhost:8090";
if (pocketbaseurl === "") { console.error("Please provide a POCKETBASE_URL in .env."); process.exit(1); };
@@ -13,15 +14,15 @@ export type userRecord = {
id: string;
username: string;
balance: number;
inventory: object;
inventory: inventory;
lastlootbox: string;
};
type TypedPocketBase = {
interface TypedPocketBase extends PocketBase {
collection(idOrName: 'auth'): RecordService<authRecord>;
collection(idOrName: 'users'): RecordService<userRecord>;
};
const pb = new PocketBase(pocketbaseurl) as TypedPocketBase;
export default pb.autoCancellation(false);
export default pb;