decord/source/modules/relationships/GuildFriendshipStore.tsx

82 lines
2.7 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13191
// Function ID: 13192
2026-07-29 08:29:29 +00:00
// Name: resetStates
2026-08-25 06:04:03 +00:00
// Dependencies: [589, 5338, 709, 2]
2026-07-23 10:11:24 +00:00
2026-08-25 06:04:03 +00:00
// Module 13191 (resetStates)
2026-08-24 06:08:38 +00:00
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-08-25 06:04:03 +00:00
import showTooManyUserGuildsAlertDefault from "showTooManyUserGuildsAlert" /* 5338 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
function resetStates() {
2026-08-24 06:08:38 +00:00
closure_3 = {};
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let closure_2 = { NOT_FETCHED: 0, [0]: "NOT_FETCHED", FETCHING: 1, [1]: "FETCHING", FETCHED: 2, [2]: "FETCHED" };
let closure_3 = {};
let c4 = 0;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class GuildFriendshipStore extends Store {
}
const prototype = GuildFriendshipStore.prototype;
prototype["isFetchingFriendsForGuild"] = function isFetchingFriendsForGuild(arg0) {
2026-07-20 16:05:17 +00:00
let fetchState;
2026-07-29 08:29:29 +00:00
if (dependencyMap[arg0] != null) {
2026-07-20 16:05:17 +00:00
fetchState = tmp.fetchState;
}
2026-07-29 08:29:29 +00:00
if (fetchState == null) {
2026-07-20 16:05:17 +00:00
fetchState = constants.NOT_FETCHED;
}
2026-07-29 08:29:29 +00:00
return fetchState === constants.FETCHING;
};
prototype["fetchFriendMembersIfNotFetched"] = function fetchFriendMembersIfNotFetched(id1, items) {
let fetchState;
if (dependencyMap[id1] != null) {
fetchState = tmp.fetchState;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (fetchState == null) {
fetchState = constants.NOT_FETCHED;
}
if (fetchState === constants.NOT_FETCHED) {
const obj = { fetchState: null, foundMembers: 0, notFoundMembers: 0 };
obj[0] = tmp4.FETCHING;
dependencyMap[id1] = obj;
2026-08-24 06:08:38 +00:00
const membersById = showTooManyUserGuildsAlertDefault.requestMembersById(id1, items, false);
const obj2 = showTooManyUserGuildsAlertDefault;
2026-07-29 08:29:29 +00:00
}
};
2026-08-24 06:08:38 +00:00
const guildFriendshipStore = new GuildFriendshipStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: resetStates,
LOGOUT: resetStates,
RELATIONSHIP_ADD: resetStates,
RELATIONSHIP_REMOVE: resetStates,
GUILD_MEMBERS_CHUNK_BATCH: function onMemberChunk(arg0) {
const first = arg0.chunks[0];
const guildId = first.guildId;
2026-07-29 08:29:29 +00:00
let fetchState;
if (dependencyMap[guildId] != null) {
fetchState = tmp2.fetchState;
}
if (fetchState == null) {
fetchState = constants.NOT_FETCHED;
}
if (fetchState === constants.FETCHING) {
2026-07-23 10:11:24 +00:00
dependencyMap[guildId].foundMembers = dependencyMap[guildId].foundMembers + first.members.length;
2026-07-20 16:05:17 +00:00
const notFound = first.notFound;
2026-07-29 08:29:29 +00:00
let num;
if (notFound != null) {
num = notFound.length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
dependencyMap[guildId].notFoundMembers = dependencyMap[guildId].notFoundMembers + num;
2026-07-29 08:29:29 +00:00
if (dependencyMap[guildId].foundMembers + dependencyMap[guildId].notFoundMembers >= c4) {
dependencyMap[guildId].fetchState = tmp5.FETCHED;
2026-07-20 16:05:17 +00:00
}
}
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/relationships/GuildFriendshipStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default guildFriendshipStore;