decord/source/modules/guild_antiraid/GuildIncidentsStore.tsx

169 lines
5.9 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 9638
// Function ID: 9639
2026-07-29 08:29:29 +00:00
// Name: computeAlertSettings
2026-08-05 07:35:12 +00:00
// Dependencies: [4169, 1340, 1862, 3883, 7904, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-05 07:35:12 +00:00
// Module 9638 (computeAlertSettings)
2026-07-29 08:29:29 +00:00
import getHash from "getHash";
import handleConnectionClosedOrResumed from "handleConnectionClosedOrResumed";
import createGuildRecordFromRust from "createGuildRecordFromRust";
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
import { Store } from "initialize";
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function computeAlertSettings() {
2026-07-23 10:11:24 +00:00
guildsProto = guildsProto.getGuildsProto();
2026-07-29 08:29:29 +00:00
if (guildsProto == null) {
2026-07-20 16:05:17 +00:00
guildsProto = {};
}
2026-07-29 08:29:29 +00:00
guildsArray = guildsArray.getGuildsArray();
let closure_7 = {};
for (const item10012 of guildsArray) {
let tmp2 = closure_7;
let obj = { guildId: null, guildName: null };
({ id: obj2[0], name: obj2[1] } = item10012);
let tmp3 = obj;
let merged = Object.assign(guildsProto[item10012.id]);
closure_7[item10012.id] = obj;
continue;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
function incidentsDataFromServer(arg0) {
2026-07-20 16:05:17 +00:00
let tmp = null;
2026-07-29 08:29:29 +00:00
if (null != arg0) {
2026-07-20 16:05:17 +00:00
const _Object = Object;
tmp = null;
2026-07-29 08:29:29 +00:00
if (Object.keys(arg0).length > 0) {
const obj = { raidDetectedAt: null, dmSpamDetectedAt: null, dmsDisabledUntil: null, invitesDisabledUntil: null, lockdownDurationHours: null };
({ raid_detected_at: obj[0], dm_spam_detected_at: obj[1], dms_disabled_until: obj[2], invites_disabled_until: obj[3], lockdown_duration_hours: obj[4] } = arg0);
2026-07-20 16:05:17 +00:00
tmp = obj;
}
}
return tmp;
}
2026-07-29 08:29:29 +00:00
let closure_6 = {};
let closure_7 = {};
class GuildIncidentsStore extends Store {
}
const prototype = GuildIncidentsStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(handleConnectionClosedOrResumed, createGuildRecordFromRust, getUncachedChannelPermissions, getHash);
const items = [handleConnectionClosedOrResumed, createGuildRecordFromRust, getUncachedChannelPermissions, getHash];
this.syncWith(items, computeAlertSettings);
};
prototype["getGuildIncident"] = function getGuildIncident(id) {
return table[id];
};
prototype["getIncidentsByGuild"] = function getIncidentsByGuild() {
return closure_6;
};
prototype["getGuildAlertSettings"] = function getGuildAlertSettings() {
return closure_7;
};
GuildIncidentsStore.displayName = "GuildIncidentsStore";
const guildIncidentsStore = new GuildIncidentsStore(require("dispatcher"), {
CONNECTION_OPEN: function handleConnectionOpen(arg0) {
let closure_6 = {};
const iter = arg0.guilds[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let properties = nextResult.properties;
let incidents_data;
let tmp2 = nextResult;
let tmp3 = incidentsDataFromServer;
if (properties != null) {
incidents_data = properties.incidents_data;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp3Result = tmp3(incidents_data);
let tmp6 = tmp3Result;
let tmp7 = null != tmp3Result;
if (tmp7) {
let tmp8 = require;
let tmp9 = dependencyMap;
2026-08-05 07:35:12 +00:00
let obj = require(7904) /* DATE_CONFIG */;
2026-07-29 08:29:29 +00:00
let tmp10 = tmp3Result;
let hasDetectedActivityResult = obj.hasDetectedActivity(tmp6);
if (!hasDetectedActivityResult) {
2026-08-05 07:35:12 +00:00
let tmp8Result = tmp8(7904);
2026-07-29 08:29:29 +00:00
let tmp12 = tmp3Result;
hasDetectedActivityResult = tmp8Result.isUnderLockdown(tmp6);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp7 = hasDetectedActivityResult;
}
if (tmp7) {
let tmp13 = closure_6;
let tmp14 = nextResult;
let tmp15 = tmp3Result;
closure_6[tmp2.id] = tmp6;
}
continue;
2026-07-20 16:05:17 +00:00
}
},
GUILD_CREATE: function handleGuildCreate(guild) {
guild = guild.guild;
const properties = guild.properties;
let incidents_data;
2026-07-29 08:29:29 +00:00
if (properties != null) {
2026-07-20 16:05:17 +00:00
incidents_data = properties.incidents_data;
}
2026-07-29 08:29:29 +00:00
let tmp2 = null;
if (null != incidents_data) {
const _Object = Object;
tmp2 = null;
if (Object.keys(incidents_data).length > 0) {
const obj = { raidDetectedAt: null, dmSpamDetectedAt: null, dmsDisabledUntil: null, invitesDisabledUntil: null, lockdownDurationHours: null };
({ raid_detected_at: obj[0], dm_spam_detected_at: obj[1], dms_disabled_until: obj[2], invites_disabled_until: obj[3], lockdown_duration_hours: obj[4] } = incidents_data);
tmp2 = obj;
}
}
let tmp4 = null != tmp2;
2026-07-20 16:05:17 +00:00
if (tmp4) {
2026-08-05 07:35:12 +00:00
let hasDetectedActivityResult = require(7904) /* DATE_CONFIG */.hasDetectedActivity(tmp2);
2026-07-20 16:05:17 +00:00
if (!hasDetectedActivityResult) {
2026-08-05 07:35:12 +00:00
hasDetectedActivityResult = tmp5(7904).isUnderLockdown(tmp2);
const tmp5Result = tmp5(7904);
2026-07-20 16:05:17 +00:00
}
tmp4 = hasDetectedActivityResult;
2026-08-05 07:35:12 +00:00
const obj2 = require(7904) /* DATE_CONFIG */;
2026-07-29 08:29:29 +00:00
tmp5 = require;
2026-07-20 16:05:17 +00:00
}
if (tmp4) {
2026-07-29 08:29:29 +00:00
closure_6[guild.id] = tmp2;
2026-07-20 16:05:17 +00:00
}
},
GUILD_UPDATE: function handleGuildUpdate(guild) {
guild = guild.guild;
2026-07-29 08:29:29 +00:00
const incidents_data = guild.incidents_data;
let tmp3 = null;
if (null != incidents_data) {
const _Object = Object;
tmp3 = null;
if (Object.keys(incidents_data).length > 0) {
const obj = { raidDetectedAt: null, dmSpamDetectedAt: null, dmsDisabledUntil: null, invitesDisabledUntil: null, lockdownDurationHours: null };
({ raid_detected_at: obj[0], dm_spam_detected_at: obj[1], dms_disabled_until: obj[2], invites_disabled_until: obj[3], lockdown_duration_hours: obj[4] } = incidents_data);
tmp3 = obj;
}
}
2026-07-23 10:11:24 +00:00
if (null == tmp3) {
2026-07-20 16:05:17 +00:00
const id = guild.id;
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (!obj2.hasDetectedActivity(tmp3)) {
2026-08-05 07:35:12 +00:00
const tmp5Result = tmp5(7904);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
closure_6[guild.id] = tmp3;
2026-08-05 07:35:12 +00:00
obj2 = require(7904) /* DATE_CONFIG */;
2026-07-29 08:29:29 +00:00
tmp5 = require;
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-07-29 08:29:29 +00:00
let closure_6 = {};
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
const result = require("createGuildRecordFromRust").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;