🎨 create start.ts

This commit is contained in:
Flam3rboy 2021-05-31 00:51:54 +02:00
parent 3b9e4a23c5
commit e12197d568
5 changed files with 15 additions and 14 deletions

View File

@ -10,4 +10,4 @@ RUN apk del build-dependencies
COPY . . COPY . .
RUN npm run build RUN npm run build
EXPOSE 3002 EXPOSE 3002
CMD ["node", "dist/"] CMD ["node", "dist/start.js"]

View File

@ -2,12 +2,12 @@
"name": "@fosscord/gateway", "name": "@fosscord/gateway",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "npm run build && node dist/", "start": "npm run build && node dist/start.js",
"build": "npx tsc -b .", "build": "npx tsc -b .",
"dev": "tsnd --respawn src/index.ts" "dev": "tsnd --respawn src/start.ts"
}, },
"keywords": [], "keywords": [],
"author": "Fosscord", "author": "Fosscord",

View File

@ -1,9 +1 @@
process.on("uncaughtException", console.error); export * from "./Server";
process.on("unhandledRejection", console.error);
import { Server } from "./Server";
import { config } from "dotenv";
config();
const server = new Server();
server.listen();

View File

@ -62,7 +62,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
}) as MemberDocument[][]; }) as MemberDocument[][];
const user_guild_settings_entries = members.map((x) => x.settings); const user_guild_settings_entries = members.map((x) => x.settings);
const channels = await ChannelModel.find({ recipients: this.user_id }).exec(); const channels = await ChannelModel.find({ recipient_ids: this.user_id }).exec();
const user = await UserModel.findOne({ id: this.user_id }).exec(); const user = await UserModel.findOne({ id: this.user_id }).exec();
if (!user) return this.close(CLOSECODES.Authentication_failed); if (!user) return this.close(CLOSECODES.Authentication_failed);

9
src/start.ts Normal file
View File

@ -0,0 +1,9 @@
process.on("uncaughtException", console.error);
process.on("unhandledRejection", console.error);
import { Server } from "./Server";
import { config } from "dotenv";
config();
const server = new Server();
server.listen();