READY changes for threads ported from #876

This commit is contained in:
Rory&
2026-01-29 20:37:08 +01:00
parent e937aae191
commit b97e9e03a0
5 changed files with 11 additions and 6 deletions

View File

@@ -450,7 +450,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
...member.guild.toJSON(),
joined_at: member.joined_at,
threads: [],
threads: member.guild.channels.filter((x) => x.isThread()),
};
});
const generateGuildsListTime = taskSw.getElapsedAndReset();

View File

@@ -36,7 +36,7 @@ export enum ChannelPermissionOverwriteType {
member = 1,
group = 2,
}
export interface threadMetadata {
export interface ThreadMetadata {
archived: boolean;
auto_archive_duration: number;
archive_timestamp: string;

View File

@@ -45,4 +45,7 @@ export interface ChannelModifySchema {
flags?: number;
default_thread_rate_limit_per_user?: number;
video_quality_mode?: number;
auto_archive_duration?: number;
archived?: boolean;
locked?: boolean;
}

View File

@@ -16,10 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { ChannelType } from "../api";
export interface MessageThreadCreationSchema {
auto_archive_duration?: number;
rate_limit_per_user?: number;
name: string;
type?: number;
type?: ChannelType.GUILD_NEWS_THREAD | ChannelType.GUILD_PRIVATE_THREAD | ChannelType.GUILD_PUBLIC_THREAD;
location?: string; //0 clue what this means lol
}

View File

@@ -34,9 +34,9 @@ export interface ReadyPrivateChannel {
type: ChannelType.DM | ChannelType.GROUP_DM;
}
export type GuildOrUnavailable = { id: string; unavailable: boolean } | (Guild & { joined_at?: Date; unavailable: undefined });
export type GuildOrUnavailable = { id: string; unavailable: boolean } | (Guild & { joined_at?: Date; unavailable: undefined; threads: Channel[] });
const guildIsAvailable = (guild: GuildOrUnavailable): guild is Guild & { joined_at: Date; unavailable: false } => {
const guildIsAvailable = (guild: GuildOrUnavailable): guild is Guild & { joined_at: Date; unavailable: false; threads: Channel[] } => {
return guild.unavailable != true;
};
@@ -215,7 +215,7 @@ export class ReadyGuildDTO implements IReadyGuildDTO {
this.roles = guild.roles.map((x) => x.toJSON());
this.stage_instances = [];
this.stickers = guild.stickers;
this.threads = [];
this.threads = guild.threads;
this.version = "1"; // ??????
this.guild_hashes = {};
this.joined_at = guild.joined_at;