summary refs log tree commit diff
path: root/gateway
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-10 11:03:32 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-10 11:03:32 +0200
commit74bd98737acf89d9d56ee66a68694d82f591d591 (patch)
treeb93c79b510a962316fb14a125cac6e177e600c53 /gateway
parent:art: clean up dependencies (diff)
downloadserver-74bd98737acf89d9d56ee66a68694d82f591d591.tar.xz
:art: clean up imports + classes
Diffstat (limited to 'gateway')
-rw-r--r--gateway/src/events/Connection.ts3
-rw-r--r--gateway/src/opcodes/LazyRequest.ts10
2 files changed, 9 insertions, 4 deletions
diff --git a/gateway/src/events/Connection.ts b/gateway/src/events/Connection.ts
index c1a6b618..2cf22f7d 100644
--- a/gateway/src/events/Connection.ts
+++ b/gateway/src/events/Connection.ts
@@ -24,6 +24,7 @@ export async function Connection(
 	request: IncomingMessage
 ) {
 	try {
+		// @ts-ignore
 		socket.on("close", Close);
 		// @ts-ignore
 		socket.on("message", Message);
@@ -68,12 +69,10 @@ export async function Connection(
 		});
 
 		socket.readyTimeout = setTimeout(() => {
-			Session.delete({ session_id: socket.session_id }); //should we await?
 			return socket.close(CLOSECODES.Session_timed_out);
 		}, 1000 * 30);
 	} catch (error) {
 		console.error(error);
-		Session.delete({ session_id: socket.session_id }); //should we await?
 		return socket.close(CLOSECODES.Unknown_error);
 	}
 }
diff --git a/gateway/src/opcodes/LazyRequest.ts b/gateway/src/opcodes/LazyRequest.ts
index d37e32da..f5fd561a 100644
--- a/gateway/src/opcodes/LazyRequest.ts
+++ b/gateway/src/opcodes/LazyRequest.ts
@@ -41,6 +41,7 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
 	const items = [];
 
 	for (const role of roles) {
+		// @ts-ignore
 		const [role_members, other_members] = partition(members, (m: Member) =>
 			m.roles.find((r) => r.id === role.id)
 		);
@@ -53,9 +54,12 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
 		groups.push(group);
 
 		for (const member of role_members) {
-			member.roles = member.roles.filter((x) => x.id !== guild_id);
+			member.roles = member.roles.filter((x: Role) => x.id !== guild_id);
 			items.push({
-				member: { ...member, roles: member.roles.map((x) => x.id) },
+				member: {
+					...member,
+					roles: member.roles.map((x: Role) => x.id),
+				},
 			});
 		}
 		members = other_members;
@@ -84,7 +88,9 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
 }
 
 function partition<T>(array: T[], isValid: Function) {
+	// @ts-ignore
 	return array.reduce(
+		// @ts-ignore
 		([pass, fail], elem) => {
 			return isValid(elem)
 				? [[...pass, elem], fail]