Files
discord-decomp/modules/media_channel/useIsFirstMessageInMediaPost.tsx
T
2026-11-01 12:12:55 +02:00

64 lines
2.0 KiB
TypeScript

// Metro module 7723 (f7724).
import ChannelStore from "../../stores/ChannelStore";
import { useStateFromStores } from "../../_bundle/defaultAreStatesEqual";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
export function useIsFirstMessageInMediaPost(a0) {
return useStateFromStores([], () => {
let r1 = a0 != null;
if (r1) {
const { id, channel_id } = a0;
const r16 = SnowflakeUtils.castChannelIdAsMessageId(channel_id);
let r0 = false;
if (id === r16) {
const channel = ChannelStore.getChannel(channel_id);
const r5 = channel == null;
r0 = false;
if (!r5) {
const isForumPost = channel.isForumPost();
r0 = false;
if (isForumPost) {
const channel2 = ChannelStore.getChannel(channel.parent_id);
r0 = (channel2 == null ? void 0 : channel2.isMediaChannel()) === true;
}
}
}
r1 = r0;
}
return r1;
}, [a0]);
}
export function isFirstMessageInMediaPost(a0) {
let r1 = a0 != null;
if (r1) {
const { id, channel_id } = a0;
const r15 = SnowflakeUtils.castChannelIdAsMessageId(channel_id);
let r0 = false;
if (id === r15) {
const channel = ChannelStore.getChannel(channel_id);
const r5 = channel == null;
r0 = false;
if (!r5) {
const isForumPost = channel.isForumPost();
r0 = false;
if (isForumPost) {
const channel2 = ChannelStore.getChannel(channel.parent_id);
r0 = (channel2 == null ? void 0 : channel2.isMediaChannel()) === true;
}
}
}
r1 = r0;
}
return r1;
}
export function isFirstMessageIdInMediaPost(a0, a1) {
if (a0 !== SnowflakeUtils.castChannelIdAsMessageId(a1)) {
return false;
}
const channel = ChannelStore.getChannel(a1);
if (channel != null && channel.isForumPost()) {
const channel2 = ChannelStore.getChannel(channel.parent_id);
return (channel2 == null ? void 0 : channel2.isMediaChannel()) === true;
}
return false;
}