summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile2
-rw-r--r--package.json6
-rw-r--r--src/index.ts10
-rw-r--r--src/opcodes/Identify.ts2
-rw-r--r--src/start.ts9
5 files changed, 15 insertions, 14 deletions
diff --git a/Dockerfile b/Dockerfile

index a69b2956..990f8c54 100644 --- a/Dockerfile +++ b/Dockerfile
@@ -10,4 +10,4 @@ RUN apk del build-dependencies COPY . . RUN npm run build EXPOSE 3002 -CMD ["node", "dist/"] \ No newline at end of file +CMD ["node", "dist/start.js"] \ No newline at end of file diff --git a/package.json b/package.json
index 8f0874d6..ceaad3ca 100644 --- a/package.json +++ b/package.json
@@ -2,12 +2,12 @@ "name": "@fosscord/gateway", "version": "1.0.0", "description": "", - "main": "index.js", + "main": "dist/index.js", "scripts": { "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 .", - "dev": "tsnd --respawn src/index.ts" + "dev": "tsnd --respawn src/start.ts" }, "keywords": [], "author": "Fosscord", diff --git a/src/index.ts b/src/index.ts
index 2fe360e2..7513bd2f 100644 --- a/src/index.ts +++ b/src/index.ts
@@ -1,9 +1 @@ -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(); +export * from "./Server"; diff --git a/src/opcodes/Identify.ts b/src/opcodes/Identify.ts
index d21041cc..1a136dd3 100644 --- a/src/opcodes/Identify.ts +++ b/src/opcodes/Identify.ts
@@ -62,7 +62,7 @@ export async function onIdentify(this: WebSocket, data: Payload) { }) as MemberDocument[][]; 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(); if (!user) return this.close(CLOSECODES.Authentication_failed); diff --git a/src/start.ts b/src/start.ts new file mode 100644
index 00000000..2fe360e2 --- /dev/null +++ b/src/start.ts
@@ -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();