decord/source/modules/game_invite_channels/GameInvitesChannelUtils.tsx

216 lines
6.8 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 5786
// Function ID: 5787
2026-07-29 08:29:29 +00:00
// Name: GAME_INVITES_CHANNEL_NO_MIC_TAG_NAME
2026-08-05 07:35:12 +00:00
// Dependencies: [109, 19, 1372, 1862, 676, 589, 5787, 5814, 5596, 5820, 5822, 2]
2026-07-29 08:29:29 +00:00
// Exports: canInviteToActivity, useFirstMessage, useGameInvitesChannelApplicationId, useGameInvitesChannelOfficialApplication, useIsGameInvitePostVoiceEnabled, useIsGameInvitesPost, useSubscribeToGameInvitePostAuthors
2026-07-20 16:05:17 +00:00
2026-08-05 07:35:12 +00:00
// Module 5786 (GAME_INVITES_CHANNEL_NO_MIC_TAG_NAME)
2026-07-23 10:11:24 +00:00
import _objectWithoutProperties from "_objectWithoutProperties";
2026-07-29 08:29:29 +00:00
import { useMemo } from "noop";
import ensureGuildLoaded from "ensureGuildLoaded";
import createGuildRecordFromRust from "createGuildRecordFromRust";
2026-07-23 10:11:24 +00:00
import ME from "ME";
2026-07-29 08:29:29 +00:00
let c9;
let metroImportAll;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let closure_3 = ["data"];
({ ActivityFlags: metroImportAll, ActivityTypes: c9 } = ME);
let closure_10 = { "1509696536903417891": "1373923512766697512" };
let c11 = "No Mic";
const result = require("ensureGuildLoaded").fileFinishedImporting("modules/game_invite_channels/GameInvitesChannelUtils.tsx");
export const GAME_INVITES_CHANNEL_NO_MIC_TAG_NAME = "No Mic";
export const useIsGameInvitesPost = function useIsGameInvitesPost(channel) {
const _require = channel;
const items = [ensureGuildLoaded];
return _require(589).useStateFromStores(items, () => {
let tmp = null != closure_0;
if (tmp) {
const isForumPostResult = obj.isForumPost();
let tmp3 = !isForumPostResult;
if (isForumPostResult) {
tmp3 = null == obj.parent_id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp4 = !tmp3;
if (!tmp3) {
const channel = outer1_6.getChannel(obj.parent_id);
let flag;
if (channel != null) {
flag = channel.isGameInvitesChannel();
}
if (flag == null) {
flag = false;
}
tmp4 = flag;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = tmp4;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
});
};
export const useIsGameInvitePostVoiceEnabled = function useIsGameInvitePostVoiceEnabled(thread) {
2026-08-05 07:35:12 +00:00
const appliedTags = _require(5787).useAppliedTags(thread);
2026-07-29 08:29:29 +00:00
_require = thread;
2026-08-05 07:35:12 +00:00
const obj = _require(5787);
2026-07-29 08:29:29 +00:00
const items = [ensureGuildLoaded];
const obj3 = _require(589);
return _require(589).useStateFromStores(items, () => {
let tmp = null != closure_0;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-29 08:29:29 +00:00
const isForumPostResult = obj.isForumPost();
let tmp3 = !isForumPostResult;
if (isForumPostResult) {
tmp3 = null == obj.parent_id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp4 = !tmp3;
2026-07-20 16:05:17 +00:00
if (!tmp3) {
2026-07-29 08:29:29 +00:00
const channel = outer1_6.getChannel(obj.parent_id);
let flag;
if (channel != null) {
flag = channel.isGameInvitesChannel();
}
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = flag;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = tmp4;
2026-07-20 16:05:17 +00:00
}
return tmp;
2026-07-29 08:29:29 +00:00
}) && !appliedTags.some((name) => name.name === closure_11);
};
export const useFirstMessage = function useFirstMessage(stateFromStores, enabled) {
2026-08-05 07:35:12 +00:00
let obj = require(5814) /* loadForumPostData */;
2026-07-29 08:29:29 +00:00
obj = { enabled, allowArchived: true };
return obj.useFirstForumPostMessage(stateFromStores, obj);
};
export const useGameInvitesChannelApplicationId = function useGameInvitesChannelApplicationId(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-29 08:29:29 +00:00
const items = [createGuildRecordFromRust];
2026-07-20 16:05:17 +00:00
const items1 = [arg0];
2026-07-29 08:29:29 +00:00
let tmp2 = null;
const stateFromStores = _require(589).useStateFromStores(items, () => {
let tmp2 = null;
if (null != application) {
const guild = outer1_7.getGuild(tmp);
2026-07-20 16:05:17 +00:00
let first;
2026-07-29 08:29:29 +00:00
if (guild != null) {
2026-07-20 16:05:17 +00:00
const gameApplicationIds = guild.gameApplicationIds;
2026-07-29 08:29:29 +00:00
if (gameApplicationIds != null) {
2026-07-20 16:05:17 +00:00
first = gameApplicationIds[0];
}
}
2026-07-29 08:29:29 +00:00
if (first == null) {
first = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = first;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
}, items1);
if (null != arg0) {
2026-07-29 08:29:29 +00:00
tmp2 = dependencyMap[arg0];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp2 == null) {
tmp2 = stateFromStores;
2026-07-20 16:05:17 +00:00
}
return tmp2;
};
export const useGameInvitesChannelOfficialApplication = function useGameInvitesChannelOfficialApplication(arg0) {
2026-07-29 08:29:29 +00:00
let application = arg0;
const items = [createGuildRecordFromRust];
const items1 = [arg0];
let tmp4 = null;
const stateFromStores = application(589).useStateFromStores(items, () => {
let tmp2 = null;
if (null != application) {
const guild = outer1_7.getGuild(tmp);
let first;
if (guild != null) {
const gameApplicationIds = guild.gameApplicationIds;
if (gameApplicationIds != null) {
first = gameApplicationIds[0];
}
}
if (first == null) {
first = null;
}
tmp2 = first;
}
return tmp2;
}, items1);
if (null != arg0) {
tmp4 = dependencyMap[arg0];
}
if (tmp4 == null) {
tmp4 = stateFromStores;
}
const obj = application(589);
const tmp = application;
2026-08-05 07:35:12 +00:00
application = application(5596).useApplication(tmp4);
2026-07-29 08:29:29 +00:00
const items2 = [application];
2026-07-20 16:05:17 +00:00
return useMemo(() => {
2026-07-23 10:11:24 +00:00
const merged = Object.assign(outer1_4(application, outer1_3));
2026-07-20 16:05:17 +00:00
return { application: application.data };
2026-07-29 08:29:29 +00:00
}, items2);
2026-07-20 16:05:17 +00:00
};
export const useSubscribeToGameInvitePostAuthors = function useSubscribeToGameInvitePostAuthors(isGameInvitesChannel) {
2026-07-23 10:11:24 +00:00
const _require = isGameInvitesChannel;
let closure_1 = arg1;
2026-07-20 16:05:17 +00:00
const isGameInvitesChannelResult = isGameInvitesChannel.isGameInvitesChannel();
const dependencyMap = isGameInvitesChannelResult;
2026-07-29 08:29:29 +00:00
let items = [ensureGuildLoaded];
2026-07-20 16:05:17 +00:00
const items1 = [isGameInvitesChannelResult, arg1];
2026-07-29 08:29:29 +00:00
const stateFromStoresArray = _require(589).useStateFromStoresArray(items, () => {
2026-07-23 10:11:24 +00:00
if (closure_2) {
2026-07-20 16:05:17 +00:00
const _Set = Set;
const set = new Set();
const items = [];
2026-07-29 08:29:29 +00:00
const tmp7 = dependencyMap[Symbol.iterator]();
while (tmp7 !== undefined) {
let tmp12 = outer1_6;
let channel = outer1_6.getChannel(tmp10);
let ownerId;
if (channel != null) {
ownerId = channel.ownerId;
}
let tmp15 = ownerId;
let hasItem = null == ownerId;
if (!hasItem) {
let tmp17 = ownerId;
hasItem = set.has(tmp15);
}
if (!hasItem) {
let tmp18 = ownerId;
let addResult = set.add(tmp15);
let arr = items.push(tmp15);
}
continue;
2026-07-20 16:05:17 +00:00
}
return items;
} else {
return [];
}
}, items1);
const items2 = [stateFromStoresArray, isGameInvitesChannel.guild_id, isGameInvitesChannelResult];
2026-07-29 08:29:29 +00:00
let obj = _require(589);
2026-07-20 16:05:17 +00:00
const tmp3 = useMemo(() => {
2026-07-29 08:29:29 +00:00
const obj = {};
2026-07-23 10:11:24 +00:00
if (closure_2) {
obj[isGameInvitesChannel.guild_id] = stateFromStoresArray;
2026-07-29 08:29:29 +00:00
let tmp = obj;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}, items2);
2026-08-05 07:35:12 +00:00
const subscribeGuildMembers = _require(5820).useSubscribeGuildMembers(tmp3, "GameInvitesChannelPostAuthors");
2026-07-20 16:05:17 +00:00
};
export const canInviteToActivity = function canInviteToActivity(type) {
let tmp = type.type === constants2.PLAYING;
if (tmp) {
2026-08-05 07:35:12 +00:00
tmp = importDefault(5822)(type, constants.JOIN);
2026-07-20 16:05:17 +00:00
}
return tmp;
};