From 86995a45a3433ef30bc7ece94b18cfbacd80bd67 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sat, 22 Apr 2023 12:09:28 +0100 Subject: [PATCH] fix: create system user on collection creation --- package.json | 2 +- src/collections/UserCollection.ts | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4269d176..d098592b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "revolt.js", - "version": "7.0.0-beta.3", + "version": "7.0.0-beta.4", "main": "lib/cjs/index.js", "module": "lib/esm/index.js", "types": "src/index.ts", diff --git a/src/collections/UserCollection.ts b/src/collections/UserCollection.ts index 5ad5cc5f..5ac4ed3d 100644 --- a/src/collections/UserCollection.ts +++ b/src/collections/UserCollection.ts @@ -1,4 +1,4 @@ -import { API, User } from ".."; +import { API, Client, User } from ".."; import { HydratedUser } from "../hydration"; import { ClassCollection } from "."; @@ -7,6 +7,19 @@ import { ClassCollection } from "."; * Collection of Users */ export class UserCollection extends ClassCollection { + /** + * Construct User collection + */ + constructor(client: Client) { + super(client); + + const SYSTEM_ID = "0".repeat(26); + this.getOrCreate(SYSTEM_ID, { + _id: SYSTEM_ID, + username: "Revolt", + }); + } + /** * Fetch user by ID * @param id Id