decord/source/modules/guild_antiraid/GuildIncidentsStore.tsx

163 lines
4.8 KiB
TypeScript
Raw Normal View History

// Module ID: 10209
// Function ID: 10210
// Name: GuildIncidentsStore
// Dependencies: [4552, 1221, 1979, 4275, 8119, 504, 573, 2]
2026-07-20 16:05:17 +00:00
// Module 10209 (GuildIncidentsStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import GuildAntiRaidUtils from "GuildAntiRaidUtils" /* 8119 */;
import ExperimentStore from "ExperimentStore" /* 4552 */;
import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1221 */;
import GuildStore from "GuildStore" /* 1979 */;
import PermissionStore from "PermissionStore" /* 4275 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function computeAlertSettings() {
let guildsProto = UserSettingsProtoStore.getGuildsProto();
2026-07-29 08:29:29 +00:00
if (guildsProto == null) {
2026-07-20 16:05:17 +00:00
guildsProto = {};
}
const guildsArray = GuildStore.getGuildsArray();
2026-08-24 06:08:38 +00:00
closure_7 = {};
2026-07-29 08:29:29 +00:00
for (const item10012 of guildsArray) {
let obj = { guildId: null, guildName: null };
({ id: obj2.guildId, name: obj2.guildName } = item10012);
2026-07-29 08:29:29 +00:00
let merged = Object.assign(guildsProto[item10012.id]);
closure_7[item10012.id] = obj;
continue;
2026-07-20 16:05:17 +00:00
}
}
2026-08-06 08:05:19 +00:00
function updateGuildIncident(id) {
const guild = GuildStore.getGuild(id);
2026-08-06 08:05:19 +00:00
let incidentsData;
if (guild != null) {
incidentsData = guild.incidentsData;
}
let tmp5;
if (null != incidentsData) {
let hasDetectedActivityResult = GuildAntiRaidUtils.hasDetectedActivity(incidentsData);
2026-08-06 08:05:19 +00:00
if (!hasDetectedActivityResult) {
hasDetectedActivityResult = tmp6(8119).isUnderLockdown(incidentsData);
const tmp6Result = tmp6(8119);
2026-08-06 08:05:19 +00:00
}
if (hasDetectedActivityResult) {
tmp5 = incidentsData;
}
tmp6 = require;
}
let flag = dependencyMap[id] !== tmp5;
if (flag) {
if (null == tmp5) {
delete tmp[tmp2];
flag = true;
} else {
dependencyMap[id] = tmp5;
flag = true;
2026-07-20 16:05:17 +00:00
}
}
2026-08-06 08:05:19 +00:00
return flag;
2026-07-20 16:05:17 +00:00
}
const dependencyMap = {};
2026-07-29 08:29:29 +00:00
let closure_7 = {};
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class GuildIncidentsStore extends Store {
}
const prototype = GuildIncidentsStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(UserSettingsProtoStore, GuildStore, PermissionStore, ExperimentStore);
const items = [UserSettingsProtoStore, GuildStore, PermissionStore, ExperimentStore];
2026-07-29 08:29:29 +00:00
this.syncWith(items, computeAlertSettings);
};
prototype["getGuildIncident"] = function getGuildIncident(id) {
2026-08-06 08:05:19 +00:00
return dependencyMap[id];
2026-07-29 08:29:29 +00:00
};
prototype["getIncidentsByGuild"] = function getIncidentsByGuild() {
return closure_6;
};
prototype["getGuildAlertSettings"] = function getGuildAlertSettings() {
return closure_7;
};
GuildIncidentsStore.displayName = "GuildIncidentsStore";
const guildIncidentsStore = new GuildIncidentsStore(DispatcherDefault, {
2026-07-29 08:29:29 +00:00
CONNECTION_OPEN: function handleConnectionOpen(arg0) {
2026-08-24 06:08:38 +00:00
closure_6 = {};
2026-08-06 08:05:19 +00:00
while (tmp !== undefined) {
let tmp4 = updateGuildIncident(tmp2.id);
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
},
GUILD_CREATE: function handleGuildCreate(guild) {
2026-08-06 08:05:19 +00:00
const id = guild.guild.id;
guild = GuildStore.getGuild(id);
2026-08-06 08:05:19 +00:00
let incidentsData;
if (guild != null) {
incidentsData = guild.incidentsData;
2026-07-20 16:05:17 +00:00
}
2026-08-06 08:05:19 +00:00
let tmp5;
if (null != incidentsData) {
let hasDetectedActivityResult = GuildAntiRaidUtils.hasDetectedActivity(incidentsData);
2026-07-20 16:05:17 +00:00
if (!hasDetectedActivityResult) {
hasDetectedActivityResult = tmp6(8119).isUnderLockdown(incidentsData);
const tmp6Result = tmp6(8119);
2026-07-20 16:05:17 +00:00
}
2026-08-06 08:05:19 +00:00
if (hasDetectedActivityResult) {
tmp5 = incidentsData;
}
tmp6 = require;
2026-07-20 16:05:17 +00:00
}
2026-08-06 08:05:19 +00:00
let flag = dependencyMap[id] !== tmp5;
if (flag) {
if (null == tmp5) {
delete tmp[tmp2];
flag = true;
} else {
dependencyMap[id] = tmp5;
flag = true;
}
2026-07-20 16:05:17 +00:00
}
2026-08-06 08:05:19 +00:00
return flag;
2026-07-20 16:05:17 +00:00
},
GUILD_UPDATE: function handleGuildUpdate(guild) {
2026-08-06 08:05:19 +00:00
const id = guild.guild.id;
guild = GuildStore.getGuild(id);
2026-08-06 08:05:19 +00:00
let incidentsData;
if (guild != null) {
incidentsData = guild.incidentsData;
}
let tmp5;
if (null != incidentsData) {
let hasDetectedActivityResult = GuildAntiRaidUtils.hasDetectedActivity(incidentsData);
2026-08-06 08:05:19 +00:00
if (!hasDetectedActivityResult) {
hasDetectedActivityResult = tmp6(8119).isUnderLockdown(incidentsData);
const tmp6Result = tmp6(8119);
2026-07-29 08:29:29 +00:00
}
2026-08-06 08:05:19 +00:00
if (hasDetectedActivityResult) {
tmp5 = incidentsData;
}
tmp6 = require;
2026-07-29 08:29:29 +00:00
}
2026-08-06 08:05:19 +00:00
let flag = dependencyMap[id] !== tmp5;
if (flag) {
if (null == tmp5) {
delete tmp[tmp2];
flag = true;
} else {
dependencyMap[id] = tmp5;
flag = true;
2026-07-20 16:05:17 +00:00
}
}
2026-08-06 08:05:19 +00:00
return flag;
2026-07-20 16:05:17 +00:00
},
GUILD_DELETE: function handleGuildDelete(arg0) {
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
},
LOGOUT: function handleLogout() {
2026-08-24 06:08:38 +00:00
closure_6 = {};
2026-07-20 16:05:17 +00:00
}
});
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_antiraid/GuildIncidentsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default guildIncidentsStore;