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

28 lines
923 B
TypeScript

// Metro module 15057 (f15058).
import GuildChannelStore from "../../stores/GuildChannelStore";
import { Permissions } from "../../_bundle/Module505";
import { useStateFromStores } from "../../_bundle/Module589";
import { canEveryone } from "../../utils/PermissionUtils";
export function useFirstGloballyViewbleGuildChannelId(a0) {
return useStateFromStores([GuildChannelStore], () => {
if (a0 == null) {
return void 0;
}
const selectableChannels = GuildChannelStore.getSelectableChannels(a0);
for (const item of selectableChannels) {
const channel = item.channel;
if (!canEveryone(Permissions.VIEW_CHANNEL, channel)) {
continue;
}
return channel.id;
}
const r40 = selectableChannels == null;
let r41 = void 0;
if (!r40) {
const r42 = selectableChannels[0];
r41 = r42 == null ? void 0 : r42.channel.id;
}
return r41;
}, [a0]);
}