summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gateway/src/listener/listener.ts11
-rw-r--r--util/src/util/Event.ts1
-rw-r--r--util/src/util/Permissions.ts1
3 files changed, 10 insertions, 3 deletions
diff --git a/gateway/src/listener/listener.ts b/gateway/src/listener/listener.ts
index ef3dd890..16803639 100644
--- a/gateway/src/listener/listener.ts
+++ b/gateway/src/listener/listener.ts
@@ -116,7 +116,7 @@ async function consume(this: WebSocket, opts: EventOpts) {
 					.has("VIEW_CHANNEL")
 			)
 				return;
-		// TODO: check if user has permission to channel
+			break;
 		case "GUILD_CREATE":
 			this.events[id] = await listenEvent(id, consumer, listenOpts);
 			break;
@@ -193,11 +193,16 @@ async function consume(this: WebSocket, opts: EventOpts) {
 			break;
 	}
 
-	Send(this, {
+	let aa = {
 		op: OPCODES.Dispatch,
 		t: event,
 		d: data,
 		s: this.sequence++,
-	});
+	}
+
+	//TODO remove before PR merge
+	console.log(aa)
+
+	Send(this, aa);
 	opts.acknowledge?.();
 }
diff --git a/util/src/util/Event.ts b/util/src/util/Event.ts
index 765e5fc7..ae296df9 100644
--- a/util/src/util/Event.ts
+++ b/util/src/util/Event.ts
@@ -5,6 +5,7 @@ import { EVENT, Event } from "../interfaces";
 const events = new EventEmitter();
 
 export async function emitEvent(payload: Omit<Event, "created_at">) {
+	console.log(payload) //TODO remove before merge
 	const id = (payload.channel_id || payload.user_id || payload.guild_id) as string;
 	if (!id) return console.error("event doesn't contain any id", payload);
 
diff --git a/util/src/util/Permissions.ts b/util/src/util/Permissions.ts
index 9d87253a..44852f1e 100644
--- a/util/src/util/Permissions.ts
+++ b/util/src/util/Permissions.ts
@@ -92,6 +92,7 @@ export class Permissions extends BitField {
 	}
 
 	overwriteChannel(overwrites: ChannelPermissionOverwrite[]) {
+		if (!overwrites) return this
 		if (!this.cache) throw new Error("permission chache not available");
 		overwrites = overwrites.filter((x) => {
 			if (x.type === 0 && this.cache.roles?.some((r) => r.id === x.id)) return true;