🐛 fix Event Emitter
This commit is contained in:
parent
762b66d50d
commit
5a505f331a
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
@ -13,15 +13,6 @@
|
||||
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||
"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}",
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -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",
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
14
src/routes/test.ts
Normal file
14
src/routes/test.ts
Normal file
@ -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;
|
@ -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,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user