summary refs log tree commit diff
path: root/util
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-03-06 22:09:36 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-03-06 22:09:36 +1100
commitce9d7339d32fe4fe249df3d10ff5b56ce31cb853 (patch)
tree52cf9742474e844db0f670e57f4e1350d1533e05 /util
parentMerge branch 'master' into maddyrtc (diff)
parentFixed npm run tsnode throwing error about ES modules for node-fetch. Probably... (diff)
downloadserver-ce9d7339d32fe4fe249df3d10ff5b56ce31cb853.tar.xz
Merge branch 'master' into maddyrtc
Diffstat (limited to 'util')
-rw-r--r--util/package-lock.json12
-rw-r--r--util/src/entities/Member.ts4
-rw-r--r--util/src/entities/ReadState.ts11
-rw-r--r--util/src/entities/User.ts5
-rw-r--r--util/src/util/TraverseDirectory.ts5
5 files changed, 27 insertions, 10 deletions
diff --git a/util/package-lock.json b/util/package-lock.json
index c5e96742..82e90b36 100644
--- a/util/package-lock.json
+++ b/util/package-lock.json
@@ -7623,9 +7623,9 @@
 			}
 		},
 		"node_modules/url-parse": {
-			"version": "1.5.3",
-			"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
-			"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
+			"version": "1.5.10",
+			"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
+			"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
 			"dependencies": {
 				"querystringify": "^2.1.1",
 				"requires-port": "^1.0.0"
@@ -14029,9 +14029,9 @@
 			}
 		},
 		"url-parse": {
-			"version": "1.5.3",
-			"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
-			"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
+			"version": "1.5.10",
+			"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
+			"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
 			"requires": {
 				"querystringify": "^2.1.1",
 				"requires-port": "^1.0.0"
diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts
index 0f7be2a7..3c5f9db0 100644
--- a/util/src/entities/Member.ts
+++ b/util/src/entities/Member.ts
@@ -86,7 +86,7 @@ export class Member extends BaseClassWithoutId {
 	joined_at: Date;
 
 	@Column({ nullable: true })
-	premium_since?: number;
+	premium_since?: Date;
 
 	@Column()
 	deaf: boolean;
@@ -245,7 +245,7 @@ export class Member extends BaseClassWithoutId {
 			nick: undefined,
 			roles: [guild_id], // @everyone role
 			joined_at: new Date(),
-			premium_since: undefined,
+			premium_since: new Date(),
 			deaf: false,
 			mute: false,
 			pending: false,
diff --git a/util/src/entities/ReadState.ts b/util/src/entities/ReadState.ts
index ebef89be..e6d73105 100644
--- a/util/src/entities/ReadState.ts
+++ b/util/src/entities/ReadState.ts
@@ -31,8 +31,17 @@ export class ReadState extends BaseClass {
 	})
 	user: User;
 
+	// fully read marker
 	@Column({ nullable: true })
-	last_message_id: string;
+	last_message_id: string; 
+	
+	// public read receipt
+	@Column({ nullable: true })
+	public_ack: string;
+
+	// notification cursor / private read receipt
+	@Column({ nullable: true })
+	notifications_cursor: string;
 
 	@Column({ nullable: true })
 	last_pin_timestamp?: Date;
diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts
index f157ac39..1d18c838 100644
--- a/util/src/entities/User.ts
+++ b/util/src/entities/User.ts
@@ -16,6 +16,7 @@ export enum PublicUserEnum {
 	banner,
 	bio,
 	bot,
+	premium_since,
 }
 export type PublicUserKeys = keyof typeof PublicUserEnum;
 
@@ -110,6 +111,9 @@ export class User extends BaseClass {
 	@Column()
 	created_at: Date; // registration date
 
+	@Column({ nullable: true })
+	premium_since: Date; // premium date
+
 	@Column({ select: false })
 	verified: boolean; // if the user is offically verified
 
@@ -246,6 +250,7 @@ export class User extends BaseClass {
 			id: Snowflake.generate(),
 			bot: false,
 			system: false,
+			premium_since: new Date(),
 			desktop: false,
 			mobile: false,
 			premium: true,
diff --git a/util/src/util/TraverseDirectory.ts b/util/src/util/TraverseDirectory.ts
index 275b7dcc..3d0d6279 100644
--- a/util/src/util/TraverseDirectory.ts
+++ b/util/src/util/TraverseDirectory.ts
@@ -1,6 +1,9 @@
 import { Server, traverseDirectory } from "lambert-server";
 
-const DEFAULT_FILTER = /^([^\.].*)(?<!\.d)\.(js)$/;
+//if we're using ts-node, use ts files instead of js
+const extension = Symbol.for("ts-node.register.instance") in process ? "ts" : "js"
+
+const DEFAULT_FILTER = new RegExp("^([^\.].*)(?<!\.d)\.(" + extension + ")$");
 
 export function registerRoutes(server: Server, root: string) {
 	return traverseDirectory(