change: make thread#guildId a getter (#1063)

This commit is contained in:
ITOH
2021-07-01 09:34:27 +01:00
committed by GitHub
parent fe2ea360ce
commit 965540c567
+4 -1
View File
@@ -1,3 +1,4 @@
import { cache } from "../../cache.ts";
import { Channel } from "../../types/channels/channel.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { ThreadMemberModified } from "../../types/channels/threads/thread_member.ts";
@@ -25,6 +26,9 @@ const baseThread: Partial<DiscordenoThread> = {
get isPublic() {
return !this.isPrivate;
},
get guildId() {
return cache.channels.get(this.parentId!)!.guildId;
},
toJSON() {
return {
id: this.id?.toString(),
@@ -59,7 +63,6 @@ export function channelToThread(channel: Channel) {
bitfield: createNewProp(bitfield),
ownerId: createNewProp(snowflakeToBigint(channel.ownerId!)),
botIsMember: createNewProp(Boolean(channel.member)),
guildId: createNewProp(snowflakeToBigint(channel.guildId!)),
members: createNewProp(new Collection<bigint, Omit<ThreadMemberModified, "id">>()),
}) as DiscordenoThread;
}