Skip to content

Commit

Permalink
Allow sending messages in voice based channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Puyodead1 committed Jun 1, 2023
1 parent eb962bd commit d0a41af
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/stores/objects/Channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,28 @@ export default class Channel {

this.hasFetchedMessages = true;
console.log(`Fetching messags for ${this.id}`);
app.rest.get<RESTGetAPIChannelMessagesResult | APIError>(
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<RESTGetAPIChannelMessagesResult | APIError>(
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
Expand All @@ -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 ||
Expand Down

0 comments on commit d0a41af

Please sign in to comment.