mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
more thread fixes
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { Channel } from "../../types/channels/channel.ts";
|
||||
import { snowflakeToBigint } from "../bigint.ts";
|
||||
|
||||
export function channelToThread(channel: Channel) {
|
||||
return {
|
||||
id: snowflakeToBigint(channel.id),
|
||||
channelId: snowflakeToBigint(channel.parentId!),
|
||||
memberCount: channel.memberCount,
|
||||
messageCount: channel.messageCount,
|
||||
archived: channel.threadMetadata?.archived || false,
|
||||
archiveTimestamp: channel.threadMetadata?.archiveTimestamp
|
||||
? Date.parse(channel.threadMetadata.archiveTimestamp)
|
||||
: undefined,
|
||||
archiverId: channel.threadMetadata?.archiverId ? snowflakeToBigint(channel.threadMetadata.archiverId) : undefined,
|
||||
autoArchiveDuration: channel.threadMetadata?.autoArchiveDuration || 0,
|
||||
locked: channel.threadMetadata?.locked || false,
|
||||
};
|
||||
}
|
||||
|
||||
export type Thread = ReturnType<typeof channelToThread>;
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./channel_to_thread.ts";
|
||||
export * from "./thread_member_modified.ts";
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ThreadMember, ThreadMemberModified } from "../../types/channels/threads/thread_member.ts";
|
||||
import { snowflakeToBigint } from "../bigint.ts";
|
||||
|
||||
export function threadMemberModified(member: ThreadMember) {
|
||||
return {
|
||||
...member,
|
||||
id: snowflakeToBigint(member.id),
|
||||
userId: snowflakeToBigint(member.userId),
|
||||
joinTimestamp: Date.parse(member.joinTimestamp),
|
||||
} as ThreadMemberModified;
|
||||
}
|
||||
Reference in New Issue
Block a user