decord/source/modules/lurker_mode/LurkingStore.tsx

225 lines
6.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 4025
// Function ID: 4026
2026-07-29 08:29:29 +00:00
// Name: initialize
2026-08-24 06:08:38 +00:00
// Dependencies: [1434, 1991, 1910, 1922, 676, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 4025 (initialize)
import set2 from "set" /* 2 */;
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import GuildNSFWContentLevel from "GuildNSFWContentLevel" /* 1434 */;
import closure_1 from "trackCommunicationDisabled" /* 1991 */;
import closure_2 from "createGuildRecordFromRust" /* 1910 */;
import closure_3 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
const isGuildLurker = GuildNSFWContentLevel.isGuildLurker;
2026-07-29 08:29:29 +00:00
({ JoinGuildSources: c4, ME: c5 } = ME);
let closure_6 = [];
let closure_7 = {};
let closure_8 = {};
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class LurkingStore extends Store {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = LurkingStore.prototype;
prototype["initialize"] = function initialize() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_1, closure_2, closure_3);
2026-07-29 08:29:29 +00:00
};
prototype["lurkingGuildIds"] = function lurkingGuildIds() {
return closure_6;
};
prototype["mostRecentLurkedGuildId"] = function mostRecentLurkedGuildId() {
let tmp = null;
if (0 !== closure_6.length) {
tmp = closure_6[closure_6.length - 1];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
};
prototype["isLurking"] = function isLurking(guildId) {
const guild = store.getGuild(guildId);
if (null == guild) {
return false;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const isCurrentUserGuestResult = currentUserGuest.isCurrentUserGuest(guildId);
let tmp6 = !isCurrentUserGuestResult;
if (!isCurrentUserGuestResult) {
tmp6 = isGuildLurker(guild);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return Boolean(tmp6);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
2026-08-11 06:20:06 +00:00
prototype["getLurkingSourceForGuild"] = function getLurkingSourceForGuild(closure_0) {
2026-07-29 08:29:29 +00:00
let tmp = null;
2026-08-11 06:20:06 +00:00
if (null != closure_0) {
let tmp3 = table2[closure_0];
2026-07-29 08:29:29 +00:00
if (tmp3 == null) {
tmp3 = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = tmp3;
2026-07-20 16:05:17 +00:00
}
return tmp;
2026-07-29 08:29:29 +00:00
};
prototype["getLoadId"] = function getLoadId(arg0) {
let tmp = null;
if (null != arg0) {
tmp = table[arg0];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
};
LurkingStore.displayName = "LurkingStore";
2026-08-24 06:08:38 +00:00
const lurkingStore = new LurkingStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen() {
2026-07-29 08:29:29 +00:00
const guildsArray = store.getGuildsArray();
const found = guildsArray.filter((arg0) => callback(arg0));
2026-08-24 06:08:38 +00:00
closure_6 = found.map((id) => id.id);
closure_8 = {};
2026-07-20 16:05:17 +00:00
},
GUILD_JOIN: function handleGuildJoin(lurker) {
({ guildId, source, loadId } = lurker);
if (lurker.lurker) {
2026-07-29 08:29:29 +00:00
if (guildId !== closure_5) {
const hasItem = items.includes(guildId);
if (!hasItem) {
items = [];
items[HermesBuiltin.arraySpread(items, 0)] = guildId;
}
}
2026-07-20 16:05:17 +00:00
if (null != loadId) {
2026-07-29 08:29:29 +00:00
closure_7[guildId] = loadId;
2026-07-20 16:05:17 +00:00
}
if (constants.MOBILE_GUILD_DISCOVERY === source) {
2026-07-29 08:29:29 +00:00
let obj = { type: null };
2026-08-04 08:36:32 +00:00
obj[0] = tmp12.MOBILE_GUILD_DISCOVERY;
2026-07-29 08:29:29 +00:00
closure_8[guildId] = obj;
2026-08-04 08:36:32 +00:00
} else if (tmp12.DIRECTORY_ENTRY === source) {
2026-07-29 08:29:29 +00:00
obj = { type: null, directoryChannelId: null };
2026-08-04 08:36:32 +00:00
obj[0] = tmp12.DIRECTORY_ENTRY;
obj[1] = tmp3;
2026-07-29 08:29:29 +00:00
closure_8[guildId] = obj;
2026-08-11 06:20:06 +00:00
} else if (tmp12.GAME_COMMUNITY_UPSELL === source) {
obj = { type: null };
obj[0] = tmp12.GAME_COMMUNITY_UPSELL;
closure_8[guildId] = obj;
2026-07-20 16:05:17 +00:00
} else {
2026-08-04 08:36:32 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
}
return true;
} else {
return false;
}
},
GUILD_STOP_LURKING: function handleGuildStopLurking(ignoredGuildIds) {
2026-07-29 08:29:29 +00:00
ignoredGuildIds = ignoredGuildIds.ignoredGuildIds;
let set;
if (ignoredGuildIds == null) {
ignoredGuildIds = [];
}
let items = [...ignoredGuildIds];
set = new Set(items);
2026-08-24 06:08:38 +00:00
const items1 = [...items];
2026-07-29 08:29:29 +00:00
return items1.reduce((arg0, arg1) => {
let tmp4 = arg0;
if (!set.has(arg1)) {
2026-08-24 06:08:38 +00:00
const index = items.indexOf(arg1);
2026-07-29 08:29:29 +00:00
let flag = false;
if (index > -1) {
2026-08-24 06:08:38 +00:00
items = [];
HermesBuiltin.arraySpread(items, 0);
2026-07-29 08:29:29 +00:00
items.splice(index, 1);
delete tmp3[tmp2];
delete tmp[tmp2];
flag = true;
}
if (!flag) {
flag = arg0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = flag;
}
return tmp4;
}, false);
2026-07-20 16:05:17 +00:00
},
2026-07-29 08:29:29 +00:00
GUILD_STOP_LURKING_FAILURE: function handleGuildStopLurkingFailure(arg0) {
({ lurkingGuildId, lurkingSource } = arg0);
if (lurkingGuildId !== closure_5) {
const hasItem = items.includes(lurkingGuildId);
if (!hasItem) {
items = [];
items[HermesBuiltin.arraySpread(items, 0)] = lurkingGuildId;
}
}
if (null == lurkingSource) {
delete tmp[tmp2];
} else {
closure_8[lurkingGuildId] = lurkingSource;
}
2026-07-20 16:05:17 +00:00
return true;
},
GUILD_CREATE: function handleGuildCreate(guild) {
guild = guild.guild;
2026-07-29 08:29:29 +00:00
let tmp4 = null == guild.joined_at;
if (!tmp4) {
tmp4 = !items.includes(guild.id);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let flag = !tmp4;
if (!tmp4) {
const index = items.indexOf(guild.id);
2026-07-20 16:05:17 +00:00
flag = true;
2026-07-29 08:29:29 +00:00
if (index > -1) {
items = [];
HermesBuiltin.arraySpread(items, 0);
items.splice(index, 1);
delete tmp3[tmp2];
delete tmp[tmp2];
flag = true;
}
2026-07-20 16:05:17 +00:00
}
return flag;
},
GUILD_DELETE: function handleGuildDelete(guild) {
guild = guild.guild;
2026-07-29 08:29:29 +00:00
let flag = items.includes(guild.id);
if (flag) {
const index = items.indexOf(guild.id);
2026-07-20 16:05:17 +00:00
flag = true;
2026-07-29 08:29:29 +00:00
if (index > -1) {
items = [];
HermesBuiltin.arraySpread(items, 0);
items.splice(index, 1);
delete tmp3[tmp2];
delete tmp[tmp2];
flag = true;
}
2026-07-20 16:05:17 +00:00
}
return flag;
},
2026-07-29 08:29:29 +00:00
GUILD_MEMBER_ADD: function handleGuildMemberAdd(guildId) {
2026-07-20 16:05:17 +00:00
guildId = guildId.guildId;
2026-07-23 10:11:24 +00:00
currentUser = currentUser.getCurrentUser();
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (currentUser != null) {
2026-07-20 16:05:17 +00:00
id = currentUser.id;
}
2026-07-29 08:29:29 +00:00
let tmp6 = guildId.user.id !== id || null == guildId.joinedAt;
if (!tmp6) {
tmp6 = !items.includes(guildId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let flag = !tmp6;
if (!tmp6) {
const index = items.indexOf(guildId);
2026-07-20 16:05:17 +00:00
flag = true;
2026-07-29 08:29:29 +00:00
if (index > -1) {
items = [];
HermesBuiltin.arraySpread(items, 0);
items.splice(index, 1);
delete tmp3[tmp2];
delete tmp[tmp2];
flag = true;
}
2026-07-20 16:05:17 +00:00
}
return flag;
}
});
2026-08-24 06:08:38 +00:00
const result = set2.fileFinishedImporting("modules/lurker_mode/LurkingStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default lurkingStore;