diff --git a/gateway/src/opcodes/Heartbeat.ts b/gateway/src/opcodes/Heartbeat.ts
index 50394130..42b72d4b 100644
--- a/gateway/src/opcodes/Heartbeat.ts
+++ b/gateway/src/opcodes/Heartbeat.ts
@@ -2,7 +2,7 @@ import { Payload, WebSocket } from "@fosscord/gateway";
import { setHeartbeat } from "../util/Heartbeat";
import { Send } from "../util/Send";
-export async function onHeartbeat(this: WebSocket, data: Payload) {
+export async function onHeartbeat(this: WebSocket, _data: Payload) {
// TODO: validate payload
setHeartbeat(this);
diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts
index 13d55559..c6c24fcd 100644
--- a/gateway/src/opcodes/Identify.ts
+++ b/gateway/src/opcodes/Identify.ts
@@ -83,7 +83,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
// TODO: public user selection
}),
// save the session and delete it when the websocket is closed
- new Session({
+ Object.assign(new Session(),{
user_id: this.user_id,
session_id: session_id,
// TODO: check if status is only one of: online, dnd, offline, idle
diff --git a/gateway/src/opcodes/LazyRequest.ts b/gateway/src/opcodes/LazyRequest.ts
index 974769e9..0dbdb526 100644
--- a/gateway/src/opcodes/LazyRequest.ts
+++ b/gateway/src/opcodes/LazyRequest.ts
@@ -1,4 +1,4 @@
-import { getPermission, listenEvent, Member, Role } from "@fosscord/util";
+import { getPermission, listenEvent, Member, Role, initDatabase } from "@fosscord/util";
import { LazyRequest } from "../schema/LazyRequest";
import { Send } from "../util/Send";
import { OPCODES } from "../util/Constants";
@@ -15,8 +15,9 @@ async function getMembers(guild_id: string, range: [number, number]) {
throw new Error("range is not a valid array");
}
// TODO: wait for typeorm to implement ordering for .find queries https://github.com/typeorm/typeorm/issues/2620
+ // TODO: rewrite this, released in 0.3.0
- let members = await getRepository(Member)
+ let members = await (await initDatabase()).getRepository(Member)
.createQueryBuilder("member")
.where("member.guild_id = :guild_id", { guild_id })
.leftJoinAndSelect("member.roles", "role")
diff --git a/gateway/src/opcodes/VoiceStateUpdate.ts b/gateway/src/opcodes/VoiceStateUpdate.ts
index 7f7db9b0..1f7c2f1b 100644
--- a/gateway/src/opcodes/VoiceStateUpdate.ts
+++ b/gateway/src/opcodes/VoiceStateUpdate.ts
@@ -47,9 +47,9 @@ export async function onVoiceStateUpdate(this: WebSocket, data: Payload) {
//The event send by Discord's client on channel leave has both guild_id and channel_id as null
if (body.guild_id === null) body.guild_id = voiceState.guild_id;
- voiceState.assign(body);
+ voiceState = Object.assign(voiceState, body);
} catch (error) {
- voiceState = new VoiceState({
+ voiceState = Object.assign(new VoiceState(), {
...body,
user_id: this.user_id,
deaf: false,
|