fix: create system user on collection creation

This commit is contained in:
Paul Makles
2023-04-22 12:09:28 +01:00
parent 8a80207723
commit 86995a45a3
2 changed files with 15 additions and 2 deletions
+1 -1
View File
@@ -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",
+14 -1
View File
@@ -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<User, HydratedUser> {
/**
* 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