🐛 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",
|
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||||
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
|
"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",
|
"name": "Debug current file",
|
||||||
"program": "${file}",
|
"program": "${file}",
|
||||||
|
|||||||
BIN
package-lock.json
generated
BIN
package-lock.json
generated
Binary file not shown.
@ -73,11 +73,11 @@ export class DiscordServer extends Server {
|
|||||||
this.app.use(ErrorHandler);
|
this.app.use(ErrorHandler);
|
||||||
const indexHTML = await fs.readFile(__dirname + "/../client_test/index.html");
|
const indexHTML = await fs.readFile(__dirname + "/../client_test/index.html");
|
||||||
|
|
||||||
this.app.get("*", (req, res) => {
|
// this.app.get("*", (req, res) => {
|
||||||
res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
|
// res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24);
|
||||||
res.set("content-type", "text/html");
|
// res.set("content-type", "text/html");
|
||||||
res.send(indexHTML);
|
// res.send(indexHTML);
|
||||||
});
|
// });
|
||||||
return super.start();
|
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">) {
|
export async function emitEvent(payload: Omit<Event, "created_at">) {
|
||||||
const emitEvent = {
|
const emitEvent = {
|
||||||
created_at: Math.floor(Date.now() / 1000), // in seconds
|
created_at: new Date(), // in seconds
|
||||||
...payload,
|
...payload,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user