92 lines
3.4 KiB
TypeScript
92 lines
3.4 KiB
TypeScript
// Metro module 7797 (f7798).
|
|
import { DEFAULT_LOCKDOWN_DURATION, NAGBAR_DISPLAY_MAX_HOURS, getTimeframes } from "./GuildAntiRaidConstants";
|
|
import Module3771 from "../../_bundle/Module3771";
|
|
import { GuildIncidentAlertTypes, GuildIncidentActionTypes } from "./GuildAntiRaidTypes";
|
|
import { intl, t } from "../../intl/index.native";
|
|
let c4915_6 = {
|
|
month: "numeric",
|
|
day: "numeric",
|
|
hour: "numeric",
|
|
minute: "2-digit"
|
|
};
|
|
export { c4915_6 as DATE_CONFIG };
|
|
export function hasDetectedActivity(a0) {
|
|
return a0.dmSpamDetectedAt != null && Module3771(a0.dmSpamDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS, "hours") > Module3771() || a0.raidDetectedAt != null && Module3771(a0.raidDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS, "hours") > Module3771();
|
|
}
|
|
export function hasDetectedRaid(a0) {
|
|
return a0.raidDetectedAt != null && Module3771(a0.raidDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS, "hours") > Module3771();
|
|
}
|
|
export function hasDetectedDMRaid(a0) {
|
|
return a0.dmSpamDetectedAt != null && Module3771(a0.dmSpamDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS, "hours") > Module3771();
|
|
}
|
|
export function getIncidentAlertType(a0) {
|
|
return a0 == null ? void 0 : a0.raidDetectedAt != null && Module3771(a0.raidDetectedAt).add(NAGBAR_DISPLAY_MAX_HOURS, "hours") > Module3771() ? GuildIncidentAlertTypes.JOIN_RAID : GuildIncidentAlertTypes.DM_RAID;
|
|
}
|
|
export function getEnabledInterventions(a0, a1) {
|
|
const r1 = [];
|
|
if (a0) {
|
|
r1.push(GuildIncidentActionTypes.INVITES_DISABLED);
|
|
}
|
|
if (a1) {
|
|
r1.push(GuildIncidentActionTypes.DMS_DISABLED);
|
|
}
|
|
return r1;
|
|
}
|
|
export function getDisabledInterventions(a0, a1) {
|
|
const r1 = [];
|
|
if (!a0) {
|
|
r1.push(GuildIncidentActionTypes.INVITES_DISABLED);
|
|
}
|
|
if (!a1) {
|
|
r1.push(GuildIncidentActionTypes.DMS_DISABLED);
|
|
}
|
|
return r1;
|
|
}
|
|
export function isUnderLockdown(a0) {
|
|
return a0.dmsDisabledUntil != null && new Date(a0.dmsDisabledUntil) > new Date() || a0.invitesDisabledUntil != null && new Date(a0.invitesDisabledUntil) > new Date();
|
|
}
|
|
export function hasDMsDisabled(a0) {
|
|
return a0?.dmsDisabledUntil != null && new Date(a0.dmsDisabledUntil) > new Date();
|
|
}
|
|
export function hasInvitesDisabled(a0) {
|
|
return a0?.invitesDisabledUntil != null && new Date(a0.invitesDisabledUntil) > new Date();
|
|
}
|
|
export function initialLockdownDurationHours(a0) {
|
|
let r3 = a0?.lockdownDurationHours;
|
|
const lockdownDurationHours = r3;
|
|
if (!(lockdownDurationHours != null && getTimeframes().some((item) => item.value === lockdownDurationHours))) {
|
|
r3 = DEFAULT_LOCKDOWN_DURATION;
|
|
}
|
|
return r3;
|
|
}
|
|
export function getSecurityActionDetailsString(a0, a1) {
|
|
let dmsDisabledUntil = a0.dmsDisabledUntil;
|
|
if (dmsDisabledUntil == null) {
|
|
dmsDisabledUntil = a0.invitesDisabledUntil;
|
|
}
|
|
if (dmsDisabledUntil == null) {
|
|
return "";
|
|
}
|
|
const r2 = a0.dmsDisabledUntil != null;
|
|
const r3 = a0.invitesDisabledUntil != null;
|
|
if ((r2 && r3) === true) {
|
|
return intl.formatToPlainString(t.hCZitf, {
|
|
guildName: a1,
|
|
time: new Date(dmsDisabledUntil).toLocaleString(intl.currentLocale, c4915_6)
|
|
});
|
|
}
|
|
if (r2 === true) {
|
|
return intl.formatToPlainString(t["HNKxf+"], {
|
|
guildName: a1,
|
|
time: new Date(dmsDisabledUntil).toLocaleString(intl.currentLocale, c4915_6)
|
|
});
|
|
}
|
|
if (r3 === true) {
|
|
return intl.formatToPlainString(t.M3iSyL, {
|
|
guildName: a1,
|
|
time: new Date(dmsDisabledUntil).toLocaleString(intl.currentLocale, c4915_6)
|
|
});
|
|
}
|
|
return "";
|
|
}
|