From e4d37ff3272f8b5dd9efef0ee488ce81f2689fed Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Tue, 22 Apr 2025 20:57:01 -0500 Subject: [PATCH] fix bugs --- src/webpage/message.ts | 10 +++++----- src/webpage/voice.ts | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/webpage/message.ts b/src/webpage/message.ts index fb5da34..775a831 100644 --- a/src/webpage/message.ts +++ b/src/webpage/message.ts @@ -21,11 +21,11 @@ class Message extends SnowFlake { stickers!: Sticker[]; owner: Channel; headers: Localuser["headers"]; - embeds!: Embed[]; + embeds: Embed[] = []; author!: User; - mentions!: User[]; + mentions: User[] = []; mention_roles!: Role[]; - attachments!: File[]; //probably should be its own class tbh, should be Attachments[] + attachments: File[] = []; //probably should be its own class tbh, should be Attachments[] message_reference!: { guild_id: string; channel_id: string; @@ -277,7 +277,7 @@ class Message extends SnowFlake { this.member = _; }); } - if (this.mentions.length || this.mention_roles.length) { + if (this.mentions?.length || this.mention_roles?.length) { //currently mention_roles isn't implemented on the spacebar servers console.log(this.mentions, this.mention_roles); } @@ -592,7 +592,7 @@ class Message extends SnowFlake { username.textContent = "Blocked user"; return; } - if (message.attachments.length || message.embeds.length) { + if (message.attachments?.length || message.embeds?.length) { const b = document.createElement("b"); b.innerText = I18n.getTranslation("message.attached"); reply.append(b); diff --git a/src/webpage/voice.ts b/src/webpage/voice.ts index 1aba7c9..f988849 100644 --- a/src/webpage/voice.ts +++ b/src/webpage/voice.ts @@ -79,6 +79,7 @@ class Voice { private pstatus: string = "not connected"; public onSatusChange: (e: string) => unknown = () => {}; set status(e: string) { + console.log("state changed: " + e); this.pstatus = e; this.onSatusChange(e); } @@ -672,6 +673,7 @@ a=rtcp-mux\r`; } } async leave() { + console.warn("leave"); this.open = false; this.status = "Left voice chat"; if (this.ws) {