summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-22 08:21:32 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-22 08:21:32 +0100
commit5a505f331a6e6ae5cb90c3e89bdcfce32ea758c4 (patch)
tree8f8a107cae4a7eb3be8fc29a028d62af53de91ae
parent:bug: fix @everyone Role on guild create (diff)
downloadserver-5a505f331a6e6ae5cb90c3e89bdcfce32ea758c4.tar.xz
:bug: fix Event Emitter
-rw-r--r--.vscode/launch.json9
-rw-r--r--package-lock.json4
-rw-r--r--src/Server.ts10
-rw-r--r--src/routes/test.ts14
-rw-r--r--src/util/Event.ts2
5 files changed, 22 insertions, 17 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 9d3bb449..570e485a 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -14,15 +14,6 @@
 			"outFiles": ["${workspaceFolder}/dist/**/*.js"]
 		},
 		{
-			"sourceMaps": true,
-			"type": "node",
-			"request": "launch",
-			"name": "Test",
-			"program": "${workspaceFolder}/dist/test/mongo_test.js",
-			"preLaunchTask": "tsc: build - tsconfig.json",
-			"outFiles": ["${workspaceFolder}/dist/**/*.js"]
-		},
-		{
 			"name": "Debug current file",
 			"program": "${file}",
 			"request": "launch",
diff --git a/package-lock.json b/package-lock.json
index 530f1faf..6dd6eaba 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1363,7 +1363,7 @@
 		},
 		"node_modules/fosscord-server-util": {
 			"version": "1.0.0",
-			"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#57746da87206f31c8612b975df37305fb2a5e0b7",
+			"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#0ab57bb6cd92dbd8c90f716645139d691de7493d",
 			"license": "ISC",
 			"dependencies": {
 				"jsonwebtoken": "^8.5.1",
@@ -5077,7 +5077,7 @@
 			"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
 		},
 		"fosscord-server-util": {
-			"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#57746da87206f31c8612b975df37305fb2a5e0b7",
+			"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#0ab57bb6cd92dbd8c90f716645139d691de7493d",
 			"from": "fosscord-server-util@github:fosscord/fosscord-server-util",
 			"requires": {
 				"jsonwebtoken": "^8.5.1",
diff --git a/src/Server.ts b/src/Server.ts
index 18bd1c7a..0c92e1b7 100644
--- a/src/Server.ts
+++ b/src/Server.ts
@@ -73,11 +73,11 @@ export class DiscordServer extends Server {
 		this.app.use(ErrorHandler);
 		const indexHTML = await fs.readFile(__dirname + "/../client_test/index.html");
 
-		this.app.get("*", (req, res) => {
-			res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
-			res.set("content-type", "text/html");
-			res.send(indexHTML);
-		});
+		// this.app.get("*", (req, res) => {
+		// 	res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
+		// 	res.set("content-type", "text/html");
+		// 	res.send(indexHTML);
+		// });
 		return super.start();
 	}
 }
diff --git a/src/routes/test.ts b/src/routes/test.ts
new file mode 100644
index 00000000..b488d6e4
--- /dev/null
+++ b/src/routes/test.ts
@@ -0,0 +1,14 @@
+import { Router } from "express";
+import { getPermission, MemberModel, db } from "fosscord-server-util";
+import { Types } from "mongoose";
+const router: Router = Router();
+
+router.get("/", async (req, res) => {
+	// @ts-ignore
+	const perm = await getPermission(813185668657184768n, 813189959920910336n);
+	console.log(perm);
+	if (perm.has("ADD_REACTIONS")) console.log("add");
+	res.send("OK");
+});
+
+export default router;
diff --git a/src/util/Event.ts b/src/util/Event.ts
index c75c909f..39389cbb 100644
--- a/src/util/Event.ts
+++ b/src/util/Event.ts
@@ -2,7 +2,7 @@ import { Event, EventModel } from "fosscord-server-util";
 
 export async function emitEvent(payload: Omit<Event, "created_at">) {
 	const emitEvent = {
-		created_at: Math.floor(Date.now() / 1000), // in seconds
+		created_at: new Date(), // in seconds
 		...payload,
 	};