From d0a41afab99be958049f1ec2a7daefc8c59d5038 Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Thu, 1 Jun 2023 10:57:35 -0400 Subject: [PATCH] Allow sending messages in voice based channels --- src/stores/objects/Channel.ts | 44 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/stores/objects/Channel.ts b/src/stores/objects/Channel.ts index 6bf966f..cdd2337 100644 --- a/src/stores/objects/Channel.ts +++ b/src/stores/objects/Channel.ts @@ -171,25 +171,28 @@ export default class Channel { this.hasFetchedMessages = true; console.log(`Fetching messags for ${this.id}`); - app.rest.get( - Routes.channelMessages(this.id), - opts, - ).then((res) => { - if("code" in res) { - console.error(res); - return; - } - this.messages.addAll( - res.filter((x) => !this.messages.has(x.id)).reverse(), - // .sort((a, b) => { - // const aTimestamp = new Date(a.timestamp as unknown as string); - // const bTimestamp = new Date(b.timestamp as unknown as string); - // return aTimestamp.getTime() - bTimestamp.getTime(); - // }) - ); - }).catch((err) => { - console.error(err); - }); + app.rest + .get( + Routes.channelMessages(this.id), + opts, + ) + .then((res) => { + if ("code" in res) { + console.error(res); + return; + } + this.messages.addAll( + res.filter((x) => !this.messages.has(x.id)).reverse(), + // .sort((a, b) => { + // const aTimestamp = new Date(a.timestamp as unknown as string); + // const bTimestamp = new Date(b.timestamp as unknown as string); + // return aTimestamp.getTime() - bTimestamp.getTime(); + // }) + ); + }) + .catch((err) => { + console.error(err); + }); } @action @@ -213,7 +216,8 @@ export default class Channel { get isTextChannel() { return ( this.type === ChannelType.GuildText || - this.type === ChannelType.GuildStore || + this.type === ChannelType.GuildVoice || + this.type === ChannelType.GuildStageVoice || this.type === ChannelType.GuildForum || this.type === ChannelType.AnnouncementThread || this.type === ChannelType.Encrypted ||