1304 lines
39 KiB
TypeScript
1304 lines
39 KiB
TypeScript
// Metro module 1942 (f1943).
|
|
import { clearCommunicationDisabledNotice } from "../modules/guild_communication_disabled/useCommunicationDisabledNoticeStore";
|
|
import ImpersonateStore from "../modules/impersonate/ImpersonateStore";
|
|
import AuthenticationStore from "./AuthenticationStore";
|
|
import ChannelStore from "./ChannelStore";
|
|
import GuildRoleStore from "./GuildRoleStore";
|
|
import GuildStore from "./GuildStore";
|
|
import { GuildMemberFlags } from "../modules/guild_member/GuildMemberConstants";
|
|
import Logger from "../modules/debug/Logger";
|
|
import { isMemberCommunicationDisabled } from "../modules/guild_communication_disabled/CommunicationDisabledUtils";
|
|
import { doesRoleSortHigher } from "../utils/GuildRoleUtils";
|
|
import { hasFlag, addFlag } from "../_bundle/Module1384";
|
|
import SnowflakeUtils from "../utils/SnowflakeUtils";
|
|
import { parseAvatarDecorationData } from "../modules/collectibles/avatar_decorations/AvatarDecorationUtils";
|
|
import { parseServerUserCollectibles } from "../modules/collectibles/utils/mappers";
|
|
import { parseServerDisplayNameStyles } from "../modules/display_name_styles/DisplayNameStylesUtils";
|
|
import { isNotNullish } from "../utils/GlobalUtils";
|
|
import isActivityParticipantValidGuildMember from "../modules/activities/isActivityParticipantValidGuildMember";
|
|
import Module12 from "../_bundle/Module12";
|
|
import { getEmbeddedActivityLocationGuildId } from "../modules/activities/utils/embeddedActivityLocationUtils";
|
|
import Module589 from "../_bundle/Module589";
|
|
import Dispatcher from "../Dispatcher";
|
|
import { HermesBuiltin } from "../_hermes/prelude";
|
|
function $mk70667($env) {
|
|
return (a0) => {
|
|
const r14 = $env;
|
|
const r8 = r14[1];
|
|
const r16 = r8[a0.user.id];
|
|
const id2 = a0.user.id;
|
|
const r21 = $env.$parent;
|
|
const r13 = r21[26];
|
|
const guildId = r14[0];
|
|
const r11 = r21[0];
|
|
const r25 = r21[2];
|
|
const r9 = {
|
|
userId: a0.user.id,
|
|
nick: a0.nick,
|
|
guildId,
|
|
avatar: a0.avatar,
|
|
avatarDecoration: r11(r25[12]).parseAvatarDecorationData(a0.avatar_decoration_data),
|
|
guildRoles: r21[7].getUnsafeMutableRoles(r14[2].id),
|
|
roles: a0.roles,
|
|
premiumSince: a0.premium_since,
|
|
isPending: a0.pending,
|
|
joinedAt: a0.joined_at,
|
|
communicationDisabledUntil: a0.communication_disabled_until,
|
|
flags: a0.flags,
|
|
fullProfileLoadedTimestamp: r16?.fullProfileLoadedTimestamp,
|
|
unusualDMActivityUntil: null,
|
|
collectibles: null,
|
|
displayNameStyles: null
|
|
};
|
|
let unusual_dm_activity_until = a0.unusual_dm_activity_until;
|
|
if (unusual_dm_activity_until == null) {
|
|
unusual_dm_activity_until = r16?.unusualDMActivityUntil;
|
|
}
|
|
L13: {
|
|
r9.unusualDMActivityUntil = unusual_dm_activity_until;
|
|
r9.collectibles = r11(r25[13]).parseServerUserCollectibles(a0.collectibles);
|
|
r9.displayNameStyles = r11(r25[14]).parseServerDisplayNameStyles(a0.display_name_styles);
|
|
r8[id2] = r13(r9);
|
|
const r56 = r8[a0.user.id];
|
|
if (r56.communicationDisabledUntil != null && r11(r25[8]).isMemberCommunicationDisabled(r56)) {
|
|
const userId = r56.userId;
|
|
const r63 = [];
|
|
const r64 = r21[24];
|
|
r63[r64.GUILD] = guildId;
|
|
r63[r64.USER] = userId;
|
|
const r69 = r63.join("-");
|
|
if (!(r21[15][r69] !== r56.communicationDisabledUntil && r11(r25[8]).isMemberCommunicationDisabled(r56))) {
|
|
break L13;
|
|
}
|
|
r21[15][r69] = r56.communicationDisabledUntil;
|
|
const r80 = r21[17] + 1;
|
|
r21[17] = r80;
|
|
r21[19][r69] = r80;
|
|
} else {
|
|
(0, r21[23])(guildId, r56.userId);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
function $mk70668() {
|
|
return (a0) => a0.member;
|
|
}
|
|
function $mk70670($env) {
|
|
return (a0) => {
|
|
const [r23, r24] = a0;
|
|
const r27 = $env[0];
|
|
const r29 = r27 == null;
|
|
let user = void 0;
|
|
if (!r29) {
|
|
const users = r27.users;
|
|
user = users == null ? void 0 : users[r23];
|
|
}
|
|
if (user != null) {
|
|
return {
|
|
...r24,
|
|
user
|
|
};
|
|
}
|
|
};
|
|
}
|
|
function $mk70671() {
|
|
return (a0) => a0 != null;
|
|
}
|
|
function $mk70672($env) {
|
|
return (a0) => {
|
|
const resolved = a0.message?.resolved;
|
|
const r12 = $env;
|
|
const guild_id = r12[0].message_reference?.guild_id;
|
|
let env24707;
|
|
const r7 = env24707 = {};
|
|
env24707[0] = resolved;
|
|
if (resolved?.members != null && guild_id != null && (0, $env.$parent[30])({
|
|
id: guild_id,
|
|
members: Object.entries(resolved.members).map($mk70670(r7)).filter($mk70671())
|
|
})) {
|
|
r12[1] = true;
|
|
}
|
|
};
|
|
}
|
|
let removeCommunicationDisabled, computeDerivedMemberState, createMember, handleCachedGuilds, batchUpdateGuildMembers, getAvatarDecorationFromServerMember, buildMembers, mergeMessageResolvedMembers, c1626_10, c1626_13, c1626_19, c1626_20, c1626_21, c1626_24, c1626_32;
|
|
let $mk70673 = function() {
|
|
return (a0) => {
|
|
mergeMessageResolvedMembers(a0);
|
|
};
|
|
};
|
|
let env1626 = {};
|
|
const trackCommunicationDisabled = function trackCommunicationDisabled(a0, a1) {
|
|
if (a1.communicationDisabledUntil != null) {
|
|
if (isMemberCommunicationDisabled(a1)) {
|
|
const userId = a1.userId;
|
|
const r10 = [];
|
|
r10[c1626_24.GUILD] = a0;
|
|
r10[c1626_24.USER] = userId;
|
|
const r21 = r10.join("-");
|
|
if (env1626[15][r21] !== a1.communicationDisabledUntil && isMemberCommunicationDisabled(a1)) {
|
|
env1626[15][r21] = a1.communicationDisabledUntil;
|
|
const r31 = env1626[17] + 1;
|
|
env1626[17] = r31;
|
|
c1626_19[r21] = r31;
|
|
}
|
|
return void 0;
|
|
}
|
|
}
|
|
removeCommunicationDisabled(a0, a1.userId);
|
|
};
|
|
removeCommunicationDisabled = function removeCommunicationDisabled(a0, a1) {
|
|
if (a1 != null) {
|
|
const r36 = [];
|
|
r36[c1626_24.GUILD] = a0;
|
|
r36[c1626_24.USER] = a1;
|
|
const r42 = r36.join("-");
|
|
if (env1626[15][r42] != null) {
|
|
const r47 = env1626[17] + 1;
|
|
env1626[17] = r47;
|
|
c1626_19[r42] = r47;
|
|
}
|
|
const r49 = [];
|
|
r49[c1626_24.GUILD] = a0;
|
|
r49[c1626_24.USER] = a1;
|
|
const r53 = r49.join("-");
|
|
if (r53.split("-")[c1626_24.USER] === AuthenticationStore.getId()) {
|
|
(0, clearCommunicationDisabledNotice)(r53.split("-")[c1626_24.GUILD]);
|
|
}
|
|
delete env1626[15][r53];
|
|
} else {
|
|
const r10 = env1626[15];
|
|
for (const key in r10) {
|
|
const r17 = key.split("-");
|
|
if (r17[c1626_24.GUILD] === a0) {
|
|
const r1 = env1626[17] + 1;
|
|
env1626[17] = r1;
|
|
c1626_19[key] = r1;
|
|
if (key.split("-")[c1626_24.USER] === AuthenticationStore.getId()) {
|
|
(0, clearCommunicationDisabledNotice)(key.split("-")[c1626_24.GUILD]);
|
|
}
|
|
delete env1626[15][key];
|
|
}
|
|
}
|
|
}
|
|
};
|
|
computeDerivedMemberState = function computeDerivedMemberState(a0, a1) {
|
|
let r6 = void 0;
|
|
let r4 = void 0;
|
|
let r5 = void 0;
|
|
let r2 = void 0;
|
|
if (a1.length === 0) {
|
|
return {
|
|
colorString: null,
|
|
colorStrings: null,
|
|
colorRoleId: void 0,
|
|
hoistRoleId: void 0,
|
|
iconRoleId: void 0,
|
|
highestRoleId: void 0
|
|
};
|
|
}
|
|
for (const item of a1) {
|
|
const r34 = a0[item];
|
|
if (r34 != null) {
|
|
if (r2 == null || doesRoleSortHigher(r34, r2)) {
|
|
r2 = r34;
|
|
}
|
|
if (r34.color > 0 && (r6 == null || doesRoleSortHigher(r34, r6))) {
|
|
r6 = r34;
|
|
}
|
|
if (r34.hoist && (r4 == null || doesRoleSortHigher(r34, r4))) {
|
|
r4 = r34;
|
|
}
|
|
if ((r34.icon != null || r34.unicodeEmoji != null) && (r5 == null || doesRoleSortHigher(r34, r5))) {
|
|
r5 = r34;
|
|
}
|
|
}
|
|
}
|
|
let colorString = r6?.colorString;
|
|
if (colorString == null) {
|
|
colorString = null;
|
|
}
|
|
let colorStrings = r6?.colorStrings;
|
|
if (colorStrings == null) {
|
|
colorStrings = null;
|
|
}
|
|
return {
|
|
colorString,
|
|
colorStrings,
|
|
colorRoleId: r6?.id,
|
|
iconRoleId: r5?.id,
|
|
hoistRoleId: r4?.id,
|
|
highestRoleId: r2?.id
|
|
};
|
|
};
|
|
createMember = function createMember({ userId, nick, guildId, avatar, avatarDecoration, guildRoles, roles, premiumSince, isPending, joinedAt, communicationDisabledUntil, unusualDMActivityUntil, fullProfileLoadedTimestamp, flags, collectibles, displayNameStyles }) {
|
|
const r25 = computeDerivedMemberState(guildRoles, roles);
|
|
const r26 = {
|
|
userId,
|
|
nick,
|
|
guildId,
|
|
avatar,
|
|
avatarDecoration,
|
|
roles,
|
|
colorString: r25.colorString,
|
|
colorStrings: r25.colorStrings,
|
|
colorRoleId: r25.colorRoleId,
|
|
iconRoleId: r25.iconRoleId,
|
|
hoistRoleId: r25.hoistRoleId,
|
|
highestRoleId: r25.highestRoleId,
|
|
premiumSince,
|
|
isPending,
|
|
joinedAt,
|
|
communicationDisabledUntil,
|
|
unusualDMActivityUntil,
|
|
fullProfileLoadedTimestamp,
|
|
flags,
|
|
collectibles,
|
|
displayNameStyles
|
|
};
|
|
let flags2 = r26.flags;
|
|
if (flags2 == null) {
|
|
flags2 = 0;
|
|
}
|
|
if (hasFlag(flags2, GuildMemberFlags.IS_GUEST)) {
|
|
let flags3 = r26.flags;
|
|
if (flags3 == null) {
|
|
flags3 = 0;
|
|
}
|
|
r26.flags = addFlag(flags3, GuildMemberFlags.BYPASSES_VERIFICATION);
|
|
}
|
|
if (env1626[11][guildId] == null) {
|
|
return r26;
|
|
}
|
|
L16: {
|
|
if (userId === AuthenticationStore.getId()) {
|
|
if (!ImpersonateStore.isViewingRoles(guildId) && !ImpersonateStore.isFullServerPreview(guildId)) {
|
|
if (c1626_13[guildId] == null) {
|
|
break L16;
|
|
}
|
|
delete c1626_13[guildId];
|
|
break L16;
|
|
}
|
|
const viewingRoles = ImpersonateStore.getViewingRoles(guildId);
|
|
c1626_13[guildId] = {
|
|
...r26,
|
|
...ImpersonateStore.getMemberOptions(guildId),
|
|
roles: viewingRoles != null ? SnowflakeUtils.keys(viewingRoles) : []
|
|
};
|
|
}
|
|
}
|
|
return r26;
|
|
};
|
|
handleCachedGuilds = function handleCachedGuilds(a0) {
|
|
let member;
|
|
for (const item of a0) {
|
|
if (item.member != null) {
|
|
const r9 = env1626[14];
|
|
const r30 = r9[item.id];
|
|
const r31 = env1626[14];
|
|
const id2 = item.id;
|
|
if (r30 == null) {
|
|
member = item.member;
|
|
} else {
|
|
member = {};
|
|
HermesBuiltin.copyDataProperties(member, item.member);
|
|
member.roles = item.member.roles;
|
|
}
|
|
r31[id2] = member;
|
|
if (env1626[11][item.id] != null) {
|
|
const r41 = env1626[11];
|
|
const r44 = r41[item.id];
|
|
if (r44[item.member.userId] != null) {
|
|
r44[item.member.userId] = {
|
|
...r44[item.member.userId],
|
|
roles: item.member.roles
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const handleGuildMemberUpdate = function handleGuildMemberUpdate({ guildId, user, nick, avatar, avatarDecoration, roles, premiumSince, isPending, joinedAt, communicationDisabledUntil, unusualDMActivityUntil, flags, collectibles, displayNameStyles }) {
|
|
const r28 = env1626[11][guildId];
|
|
if (r28 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(guildId);
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during GUILD_MEMBER_UPDATE.`);
|
|
return false;
|
|
}
|
|
const id2 = user.id;
|
|
const r30 = {
|
|
userId: user.id,
|
|
nick,
|
|
guildId,
|
|
avatar,
|
|
avatarDecoration: parseAvatarDecorationData(avatarDecoration),
|
|
guildRoles: GuildRoleStore.getUnsafeMutableRoles(guild.id),
|
|
roles,
|
|
premiumSince,
|
|
isPending,
|
|
joinedAt,
|
|
communicationDisabledUntil,
|
|
unusualDMActivityUntil,
|
|
fullProfileLoadedTimestamp: null,
|
|
flags: null,
|
|
collectibles: null,
|
|
displayNameStyles: null
|
|
};
|
|
const fullProfileLoadedTimestamp = r28[user.id]?.fullProfileLoadedTimestamp;
|
|
L11: {
|
|
r30.fullProfileLoadedTimestamp = fullProfileLoadedTimestamp;
|
|
r30.flags = flags;
|
|
r30.collectibles = collectibles;
|
|
r30.displayNameStyles = displayNameStyles;
|
|
r28[id2] = createMember(r30);
|
|
const r45 = r28[user.id];
|
|
if (r45.communicationDisabledUntil != null && isMemberCommunicationDisabled(r45)) {
|
|
const userId = r45.userId;
|
|
const r52 = [];
|
|
r52[c1626_24.GUILD] = guildId;
|
|
r52[c1626_24.USER] = userId;
|
|
const r58 = r52.join("-");
|
|
if (!(env1626[15][r58] !== r45.communicationDisabledUntil && isMemberCommunicationDisabled(r45))) {
|
|
break L11;
|
|
}
|
|
env1626[15][r58] = r45.communicationDisabledUntil;
|
|
const r69 = env1626[17] + 1;
|
|
env1626[17] = r69;
|
|
c1626_19[r58] = r69;
|
|
} else {
|
|
removeCommunicationDisabled(guildId, r45.userId);
|
|
}
|
|
}
|
|
};
|
|
batchUpdateGuildMembers = function batchUpdateGuildMembers(a0, a1) {
|
|
let r17;
|
|
let env13358;
|
|
const r4 = env13358 = {
|
|
$parent: env1626
|
|
};
|
|
env13358[0] = a0;
|
|
const r9 = env1626[11][a0];
|
|
env13358[1] = r9;
|
|
if (r9 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(a0);
|
|
env13358[2] = guild;
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${a0} not found during batchUpdateGuildMembers.`);
|
|
r17 = false;
|
|
} else {
|
|
a1.forEach($mk70667(r4));
|
|
env1626[18] = env1626[18] + 1;
|
|
r17 = true;
|
|
}
|
|
return r17;
|
|
};
|
|
getAvatarDecorationFromServerMember = function getAvatarDecorationFromServerMember(a0) {
|
|
return parseAvatarDecorationData(a0.avatar_decoration_data);
|
|
};
|
|
buildMembers = function buildMembers(a0) {
|
|
const id2 = a0.id;
|
|
if (!(id2 in env1626[11])) {
|
|
env1626[11][a0.id] = {};
|
|
}
|
|
const guild = GuildStore.getGuild(id2);
|
|
if (guild == null) {
|
|
return false;
|
|
}
|
|
const r3 = env1626[11][id2];
|
|
for (const member of a0.members) {
|
|
const id3 = member.user.id;
|
|
const r16 = r3[id3];
|
|
const r48 = {
|
|
userId: id3,
|
|
nick: member.nick,
|
|
guildId: a0.id,
|
|
avatar: member.avatar,
|
|
avatarDecoration: getAvatarDecorationFromServerMember(member),
|
|
guildRoles: GuildRoleStore.getUnsafeMutableRoles(guild.id),
|
|
roles: member.roles,
|
|
premiumSince: member.premium_since,
|
|
isPending: member.pending,
|
|
joinedAt: member.joined_at,
|
|
communicationDisabledUntil: member.communication_disabled_until,
|
|
fullProfileLoadedTimestamp: r16?.fullProfileLoadedTimestamp,
|
|
flags: null,
|
|
unusualDMActivityUntil: null,
|
|
collectibles: null,
|
|
displayNameStyles: null
|
|
};
|
|
r48.flags = member.flags;
|
|
let unusual_dm_activity_until = member.unusual_dm_activity_until;
|
|
if (unusual_dm_activity_until == null) {
|
|
unusual_dm_activity_until = r16?.unusualDMActivityUntil;
|
|
}
|
|
r48.unusualDMActivityUntil = unusual_dm_activity_until;
|
|
r48.collectibles = parseServerUserCollectibles(member.collectibles);
|
|
r48.displayNameStyles = parseServerDisplayNameStyles(member.display_name_styles);
|
|
const r81 = createMember(r48);
|
|
r3[id3] = r81;
|
|
trackCommunicationDisabled(id2, r81);
|
|
}
|
|
return true;
|
|
};
|
|
const handleGuildRoleUpdateOrDelete = function handleGuildRoleUpdateOrDelete(a0) {
|
|
const r10 = env1626[11][a0.guildId];
|
|
if (r10 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(a0.guildId);
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${a0.guildId} not found during ${a0.type}.`);
|
|
return false;
|
|
}
|
|
const id2 = AuthenticationStore.getId();
|
|
for (const item of SnowflakeUtils.keys(r10)) {
|
|
const r52 = r10[item];
|
|
if (!(r52.roles != null && r52.roles.length > 0) && r52.colorString == null && r52.hoistRoleId == null) {
|
|
continue;
|
|
}
|
|
const roles = item === id2 && a0.type === "GUILD_ROLE_DELETE" ? r52.roles.filter((role) => role !== a0.roleId) : r52.roles;
|
|
const userId = item;
|
|
const r70 = {
|
|
userId,
|
|
nick: r52.nick,
|
|
guildId: a0.guildId,
|
|
avatar: r52.avatar,
|
|
avatarDecoration: r52.avatarDecoration,
|
|
guildRoles: GuildRoleStore.getUnsafeMutableRoles(guild.id),
|
|
roles,
|
|
premiumSince: r52.premiumSince,
|
|
isPending: r52.isPending,
|
|
joinedAt: r52.joinedAt,
|
|
flags: r52.flags,
|
|
fullProfileLoadedTimestamp: r52?.fullProfileLoadedTimestamp,
|
|
collectibles: null,
|
|
displayNameStyles: null
|
|
};
|
|
r70.collectibles = r52.collectibles;
|
|
r70.displayNameStyles = r52.displayNameStyles;
|
|
r10[userId] = createMember(r70);
|
|
trackCommunicationDisabled(a0.guildId, r10[item]);
|
|
}
|
|
};
|
|
const handleImpersonateUpdate = function handleImpersonateUpdate({ guildId }) {
|
|
const r5 = env1626[11][guildId];
|
|
if (r5 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(guildId);
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during IMPERSONATE_UPDATE.`);
|
|
return false;
|
|
}
|
|
const id2 = AuthenticationStore.getId();
|
|
const r8 = r5[id2];
|
|
r5[id2] = createMember({
|
|
userId: id2,
|
|
nick: r8.nick,
|
|
guildId,
|
|
avatar: r8.avatar,
|
|
avatarDecoration: r8.avatarDecoration,
|
|
guildRoles: GuildRoleStore.getUnsafeMutableRoles(guild.id),
|
|
roles: r8.roles,
|
|
premiumSince: r8.premiumSince,
|
|
isPending: r8.isPending,
|
|
joinedAt: r8.joinedAt,
|
|
communicationDisabledUntil: r8.communicationDisabledUntil,
|
|
fullProfileLoadedTimestamp: r8.fullProfileLoadedTimestamp,
|
|
flags: r8.flags,
|
|
collectibles: r8.collectibles,
|
|
displayNameStyles: r8.displayNameStyles
|
|
});
|
|
};
|
|
const handleIncomingMessage = function handleIncomingMessage({ message, guildId }) {
|
|
let env13360;
|
|
const r11 = env13360 = {
|
|
$parent: env1626
|
|
};
|
|
env13360[0] = message;
|
|
env13360[1] = false;
|
|
const message_snapshots = message.message_snapshots;
|
|
if (message_snapshots != null) {
|
|
message_snapshots.forEach($mk70672(r11));
|
|
}
|
|
let env13361;
|
|
const resolved = message.resolved;
|
|
const r14 = env13361 = {};
|
|
env13361[0] = resolved;
|
|
return resolved?.members != null && guildId != null && buildMembers({
|
|
id: guildId,
|
|
members: Object.entries(resolved.members).map($mk70670(r14)).filter($mk70671())
|
|
}) || env13360[1];
|
|
};
|
|
mergeMessageResolvedMembers = function mergeMessageResolvedMembers(a0) {
|
|
const guild_id = ChannelStore.getChannel(a0.channel_id)?.guild_id;
|
|
let env13362;
|
|
const r12 = env13362 = {
|
|
$parent: env1626
|
|
};
|
|
env13362[0] = a0;
|
|
env13362[1] = false;
|
|
const message_snapshots = a0.message_snapshots;
|
|
if (message_snapshots != null) {
|
|
message_snapshots.forEach($mk70672(r12));
|
|
}
|
|
let env13363;
|
|
const resolved = a0.resolved;
|
|
const r18 = env13363 = {};
|
|
env13363[0] = resolved;
|
|
if (resolved?.members != null && guild_id != null) {
|
|
buildMembers({
|
|
id: guild_id,
|
|
members: Object.entries(resolved.members).map($mk70670(r18)).filter($mk70671())
|
|
});
|
|
}
|
|
};
|
|
const handleLoadMessages = function handleLoadMessages(a0) {
|
|
a0.messages.forEach($mk70673());
|
|
};
|
|
const handleLoadSearchResults = function handleLoadSearchResults({ data }) {
|
|
const r3 = [];
|
|
let c13364_0 = r3;
|
|
data.forEach((a0) => {
|
|
a0.messages.forEach((message) => {
|
|
message.forEach((item) => {
|
|
c13364_0.push(item);
|
|
});
|
|
});
|
|
});
|
|
r3.forEach($mk70673());
|
|
};
|
|
c1626_10 = new Logger("GuildMemberStore");
|
|
env1626[11] = {};
|
|
env1626[12] = {};
|
|
c1626_13 = {};
|
|
env1626[14] = {};
|
|
env1626[15] = {};
|
|
env1626[16] = false;
|
|
env1626[17] = 0;
|
|
env1626[18] = 0;
|
|
c1626_19 = {};
|
|
c1626_20 = {};
|
|
c1626_21 = {
|
|
added: [],
|
|
removed: []
|
|
};
|
|
c1626_24 = {
|
|
GUILD: 0,
|
|
0: "GUILD",
|
|
USER: 1,
|
|
1: "USER"
|
|
};
|
|
class GuildMemberStore extends Module589.Store {
|
|
static displayName = "GuildMemberStore";
|
|
constructor() {
|
|
super(...arguments);
|
|
}
|
|
initialize() {
|
|
this.waitFor(AuthenticationStore, ChannelStore, GuildRoleStore, GuildStore, ImpersonateStore);
|
|
}
|
|
getMutableAllGuildsAndMembers() {
|
|
return env1626[11];
|
|
}
|
|
memberOf(c13365_0) {
|
|
return Module12(env1626[11]).toPairs().filter((item) => {
|
|
const [, r13] = item;
|
|
return r13[c13365_0] != null;
|
|
}).map((item) => {
|
|
const [r8] = item;
|
|
return r8;
|
|
}).value();
|
|
}
|
|
getNicknameGuildsMapping(a0) {
|
|
const r5 = {};
|
|
const r8 = env1626[11];
|
|
for (const key in r8) {
|
|
const nick = env1626[11][key][a0]?.nick;
|
|
if (nick != null) {
|
|
if (!Object.prototype.hasOwnProperty.call(r5, nick)) {
|
|
r5[nick] = [];
|
|
}
|
|
r5[nick].push(key);
|
|
}
|
|
}
|
|
return r5;
|
|
}
|
|
getNicknames(a0) {
|
|
return Object.keys(this.getNicknameGuildsMapping(a0));
|
|
}
|
|
isMember(a0, a1) {
|
|
if (a0 != null && a1 != null) {
|
|
const r6 = env1626[11][a0];
|
|
return r6 != null && r6[a1] != null;
|
|
}
|
|
return false;
|
|
}
|
|
isGuestOrLurker(a0, a1) {
|
|
if (a0 != null && a1 != null) {
|
|
const r7 = env1626[11][a0];
|
|
return r7 != null && r7[a1]?.joinedAt == null;
|
|
}
|
|
return false;
|
|
}
|
|
isCurrentUserGuest(a0) {
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
const id2 = AuthenticationStore.getId();
|
|
const r8 = env1626[11][a0];
|
|
if (r8 != null && r8[id2] != null) {
|
|
const flags = r8[id2].flags;
|
|
return flags != null && hasFlag(flags, GuildMemberFlags.IS_GUEST);
|
|
}
|
|
return false;
|
|
}
|
|
getMemberIds(a0) {
|
|
if (a0 == null) {
|
|
return [];
|
|
}
|
|
const r4 = env1626[11][a0];
|
|
return r4 == null ? [] : SnowflakeUtils.keys(r4);
|
|
}
|
|
getMembers(a0) {
|
|
if (a0 == null) {
|
|
return [];
|
|
}
|
|
const r3 = env1626[11][a0];
|
|
return r3 == null ? [] : Object.values(r3);
|
|
}
|
|
getTrueMember(a0, a1) {
|
|
const r3 = env1626[11][a0];
|
|
return r3 != null ? r3[a1] : null;
|
|
}
|
|
getMember(a0, a1) {
|
|
let r8;
|
|
L7: {
|
|
const trueMember = this.getTrueMember(a0, a1);
|
|
r8 = trueMember;
|
|
if (trueMember != null) {
|
|
const id2 = AuthenticationStore.getId();
|
|
r8 = trueMember;
|
|
if (a1 === id2) {
|
|
if (!ImpersonateStore.isViewingRoles(a0)) {
|
|
const isFullServerPreview = ImpersonateStore.isFullServerPreview(a0);
|
|
r8 = trueMember;
|
|
if (!isFullServerPreview) {
|
|
break L7;
|
|
}
|
|
}
|
|
let r17 = c1626_13[a0];
|
|
if (r17 == null) {
|
|
r17 = trueMember;
|
|
}
|
|
r8 = r17;
|
|
}
|
|
}
|
|
}
|
|
return r8;
|
|
}
|
|
getSelfMember(a0) {
|
|
return this.getMember(a0, AuthenticationStore.getId());
|
|
}
|
|
getSelfMemberJoinedAt(a0) {
|
|
const r9 = env1626[12][a0];
|
|
if (r9 != null) {
|
|
return r9;
|
|
}
|
|
const selfMember = this.getSelfMember(a0);
|
|
if (selfMember != null && selfMember.joinedAt != null) {
|
|
const date = new Date(selfMember.joinedAt);
|
|
env1626[12][a0] = date;
|
|
return date;
|
|
}
|
|
return null;
|
|
}
|
|
getCachedSelfMember(a0) {
|
|
let r4 = env1626[14][a0];
|
|
if (r4 == null) {
|
|
r4 = null;
|
|
}
|
|
return r4;
|
|
}
|
|
getNick(a0, a1) {
|
|
if (a0 != null && a1 != null) {
|
|
const member = this.getMember(a0, a1);
|
|
return member != null ? member.nick : null;
|
|
}
|
|
return null;
|
|
}
|
|
getCommunicationDisabledUserMap() {
|
|
return env1626[15];
|
|
}
|
|
getCommunicationDisabledVersion() {
|
|
return env1626[17];
|
|
}
|
|
getPendingRoleUpdates(a0) {
|
|
let r4 = c1626_20[a0];
|
|
if (r4 == null) {
|
|
r4 = c1626_21;
|
|
}
|
|
return r4;
|
|
}
|
|
getMemberRoleWithPendingUpdates(a0, a1) {
|
|
let r10 = this.getMember(a0, a1)?.roles;
|
|
if (r10 == null) {
|
|
r10 = [];
|
|
}
|
|
const r14 = c1626_20[a0];
|
|
return r14 != null ? Module12.difference(Module12.union(r10, r14.added), r14.removed) : r10;
|
|
}
|
|
getMemberVersion() {
|
|
return env1626[18];
|
|
}
|
|
}
|
|
c1626_32 = GuildMemberStore;
|
|
const r146 = new GuildMemberStore(Dispatcher, {
|
|
CONNECTION_OPEN: function handleConnectionOpen(a0) {
|
|
if (env1626[16]) {
|
|
env1626[16] = false;
|
|
} else {
|
|
env1626[11] = {};
|
|
env1626[12] = {};
|
|
}
|
|
env1626[15] = {};
|
|
a0.guilds.forEach((guild) => {
|
|
buildMembers(guild);
|
|
});
|
|
},
|
|
CONNECTION_OPEN_SUPPLEMENTAL: function handleConnectionOpenSupplemental(a0) {
|
|
a0.guilds.forEach((guild) => {
|
|
const id = guild.id;
|
|
buildMembers({
|
|
id,
|
|
members: guild.members
|
|
});
|
|
const activity_instances = guild.activity_instances;
|
|
if (activity_instances != null) {
|
|
activity_instances.forEach((activity_instance) => {
|
|
buildMembers({
|
|
id,
|
|
members: activity_instance.participants.filter(isActivityParticipantValidGuildMember).map($mk70668())
|
|
});
|
|
});
|
|
}
|
|
});
|
|
},
|
|
OVERLAY_INITIALIZE: function handleInitialize(a0) {
|
|
env1626[11] = {
|
|
...a0.guildMembers
|
|
};
|
|
env1626[12] = {};
|
|
},
|
|
CACHE_LOADED: function handleCacheLoaded({ guildMembers, guilds }) {
|
|
env1626[16] = true;
|
|
env1626[11] = {
|
|
...guildMembers
|
|
};
|
|
env1626[12] = {};
|
|
env1626[14] = {};
|
|
handleCachedGuilds(guilds);
|
|
},
|
|
CACHE_LOADED_LAZY: function handleCacheLoadedLazy(a0) {
|
|
handleCachedGuilds(a0.guilds);
|
|
},
|
|
GUILD_CREATE: function handleGuildCreate(a0) {
|
|
return buildMembers(a0.guild);
|
|
},
|
|
GUILD_DELETE: function handleGuildDelete({ guild }) {
|
|
delete env1626[11][guild.id];
|
|
delete env1626[12][guild.id];
|
|
removeCommunicationDisabled(guild.id);
|
|
},
|
|
GUILD_MEMBER_ADD: handleGuildMemberUpdate,
|
|
GUILD_MEMBER_UPDATE: handleGuildMemberUpdate,
|
|
GUILD_MEMBER_UPDATE_LOCAL: function handleGuildMemberUpdateLocal(a0) {
|
|
const guildId = a0.guildId;
|
|
let roles = a0.roles;
|
|
let addedRoleIds = a0.addedRoleIds;
|
|
const removedRoleIds = a0.removedRoleIds;
|
|
let flags = a0.flags;
|
|
const id2 = AuthenticationStore.getId();
|
|
const r24 = env1626[11][guildId];
|
|
const r7 = r24 != null ? r24[id2] : null;
|
|
if (r7 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(guildId);
|
|
if (guild == null) {
|
|
return false;
|
|
}
|
|
let r14 = c1626_20[guildId];
|
|
if (r14 == null) {
|
|
r14 = {};
|
|
}
|
|
let added = r14.added;
|
|
if (added == null) {
|
|
added = [];
|
|
}
|
|
const r31 = Module12.union(added, addedRoleIds);
|
|
let r32 = removedRoleIds;
|
|
if (r32 == null) {
|
|
r32 = [];
|
|
}
|
|
const r34 = {
|
|
added: Module12.difference(r31, r32),
|
|
removed: null
|
|
};
|
|
let removed = r14.removed;
|
|
if (removed == null) {
|
|
removed = [];
|
|
}
|
|
const r42 = Module12.union(removed, removedRoleIds);
|
|
if (addedRoleIds == null) {
|
|
addedRoleIds = [];
|
|
}
|
|
r34.removed = Module12.difference(r42, addedRoleIds);
|
|
c1626_20[guildId] = r34;
|
|
const r45 = {
|
|
userId: id2,
|
|
guildId,
|
|
nick: r7.nick,
|
|
avatar: r7.avatar,
|
|
avatarDecoration: r7.avatarDecoration,
|
|
guildRoles: GuildRoleStore.getUnsafeMutableRoles(guild.id),
|
|
roles: null,
|
|
premiumSince: null,
|
|
isPending: null,
|
|
joinedAt: null,
|
|
flags: null,
|
|
fullProfileLoadedTimestamp: null,
|
|
collectibles: null,
|
|
displayNameStyles: null
|
|
};
|
|
if (roles == null) {
|
|
roles = r7.roles;
|
|
}
|
|
r45.roles = roles;
|
|
r45.premiumSince = r7.premiumSince;
|
|
r45.isPending = r7.isPending;
|
|
r45.joinedAt = r7.joinedAt;
|
|
if (flags == null) {
|
|
flags = r7.flags;
|
|
}
|
|
r45.flags = flags;
|
|
r45.fullProfileLoadedTimestamp = r7.fullProfileLoadedTimestamp;
|
|
r45.collectibles = r7.collectibles;
|
|
r45.displayNameStyles = r7.displayNameStyles;
|
|
r24[id2] = createMember(r45);
|
|
},
|
|
GUILD_MEMBERS_CHUNK_BATCH: function handleGuildMembersChunkBatch(a0) {
|
|
let r0 = false;
|
|
for (const chunk of a0.chunks) {
|
|
r0 = batchUpdateGuildMembers(chunk.guildId, chunk.members) || r0;
|
|
}
|
|
return r0;
|
|
},
|
|
GUILD_MEMBER_REMOVE: function handleGuildMemberRemove(a0) {
|
|
const guildId = a0.guildId;
|
|
const id2 = a0.user.id;
|
|
const r9 = env1626[11][guildId];
|
|
if (r9 != null && r9[id2] != null) {
|
|
delete r9[id2];
|
|
removeCommunicationDisabled(guildId, id2);
|
|
env1626[18] = env1626[18] + 1;
|
|
}
|
|
},
|
|
GUILD_MEMBER_REMOVE_LOCAL: function handleGuildMemberRemoveLocal({ guildId, userId }) {
|
|
const r8 = env1626[11][guildId];
|
|
if (r8 != null && r8[userId] != null) {
|
|
delete r8[userId];
|
|
removeCommunicationDisabled(guildId, userId);
|
|
env1626[18] = env1626[18] + 1;
|
|
}
|
|
},
|
|
THREAD_MEMBER_LIST_UPDATE: function handleThreadMemberListUpdate(a0) {
|
|
let r30;
|
|
let env13366;
|
|
const guildId = a0.guildId;
|
|
const r18 = a0.members.map((member) => member.member).filter(isNotNullish);
|
|
const r19 = env13366 = {
|
|
$parent: env1626
|
|
};
|
|
env13366[0] = guildId;
|
|
env13366[1] = void 0;
|
|
env13366[2] = void 0;
|
|
const r21 = env1626[11][guildId];
|
|
env13366[1] = r21;
|
|
const r4 = r21 == null;
|
|
let r22 = false;
|
|
if (!r4) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
env13366[2] = guild;
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during batchUpdateGuildMembers.`);
|
|
r30 = false;
|
|
} else {
|
|
r18.forEach($mk70667(r19));
|
|
env1626[18] = env1626[18] + 1;
|
|
r30 = true;
|
|
}
|
|
r22 = r30;
|
|
}
|
|
return r22;
|
|
},
|
|
THREAD_MEMBERS_UPDATE: function handleThreadMembersUpdate({ guildId, addedMembers }) {
|
|
let r31;
|
|
let r3 = addedMembers != null;
|
|
if (r3) {
|
|
let env13367;
|
|
const r19 = addedMembers.map((addedMember) => addedMember.member).filter(isNotNullish);
|
|
const r20 = env13367 = {
|
|
$parent: env1626
|
|
};
|
|
env13367[0] = guildId;
|
|
env13367[1] = void 0;
|
|
env13367[2] = void 0;
|
|
const r22 = env1626[11][guildId];
|
|
env13367[1] = r22;
|
|
const r5 = r22 == null;
|
|
let r23 = false;
|
|
if (!r5) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
env13367[2] = guild;
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during batchUpdateGuildMembers.`);
|
|
r31 = false;
|
|
} else {
|
|
r19.forEach($mk70667(r20));
|
|
env1626[18] = env1626[18] + 1;
|
|
r31 = true;
|
|
}
|
|
r23 = r31;
|
|
}
|
|
r3 = r23;
|
|
}
|
|
return r3;
|
|
},
|
|
LOAD_ARCHIVED_THREADS_SUCCESS: function handleLoadArchivedThreadsSuccess({ guildId, owners }) {
|
|
let r20;
|
|
let env13368;
|
|
const r11 = env13368 = {
|
|
$parent: env1626
|
|
};
|
|
env13368[0] = guildId;
|
|
env13368[1] = void 0;
|
|
env13368[2] = void 0;
|
|
const r12 = env1626[11][guildId];
|
|
env13368[1] = r12;
|
|
const r4 = r12 == null;
|
|
let r13 = false;
|
|
if (!r4) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
env13368[2] = guild;
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during batchUpdateGuildMembers.`);
|
|
r20 = false;
|
|
} else {
|
|
owners.forEach($mk70667(r11));
|
|
env1626[18] = env1626[18] + 1;
|
|
r20 = true;
|
|
}
|
|
r13 = r20;
|
|
}
|
|
return r13;
|
|
},
|
|
LOAD_FORUM_POSTS: function handleLoadForumPosts(a0) {
|
|
let r28;
|
|
let env13369;
|
|
const guildId = a0.guildId;
|
|
const r16 = Object.values(a0.threads).reduce((acc, item) => {
|
|
if (item.owner != null) {
|
|
acc.push(item.owner);
|
|
}
|
|
if ((item == null ? void 0 : item.first_message?.message_snapshots) != null) {
|
|
const r13 = item.first_message.message_snapshots[0];
|
|
if (r13.moderator_report?.reported_member != null) {
|
|
acc.push(r13.moderator_report.reported_member);
|
|
}
|
|
if (r13.moderator_report?.reporting_member != null) {
|
|
acc.push(r13.moderator_report.reporting_member);
|
|
}
|
|
}
|
|
return acc;
|
|
}, []);
|
|
const r17 = env13369 = {
|
|
$parent: env1626
|
|
};
|
|
env13369[0] = guildId;
|
|
env13369[1] = void 0;
|
|
env13369[2] = void 0;
|
|
const r19 = env1626[11][guildId];
|
|
env13369[1] = r19;
|
|
const r4 = r19 == null;
|
|
let r20 = false;
|
|
if (!r4) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
env13369[2] = guild;
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during batchUpdateGuildMembers.`);
|
|
r28 = false;
|
|
} else {
|
|
r16.forEach($mk70667(r17));
|
|
env1626[18] = env1626[18] + 1;
|
|
r28 = true;
|
|
}
|
|
r20 = r28;
|
|
}
|
|
return r20;
|
|
},
|
|
GUILD_ROLE_UPDATE: handleGuildRoleUpdateOrDelete,
|
|
GUILD_ROLE_DELETE: handleGuildRoleUpdateOrDelete,
|
|
GUILD_ROLE_MEMBER_REMOVE: function handleGuildMemberRoleRemove({ guildId, userId, roleId }) {
|
|
const r4 = env1626[11][guildId];
|
|
if (r4 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(guildId);
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during GUILD_MEMBER_UPDATE.`);
|
|
return false;
|
|
}
|
|
const r17 = r4[userId];
|
|
if (r17 == null) {
|
|
return false;
|
|
}
|
|
if (r17.roles.includes(roleId)) {
|
|
r17.roles = r17.roles.filter((role) => role !== roleId);
|
|
r4[userId] = {
|
|
...r17,
|
|
...computeDerivedMemberState(GuildRoleStore.getUnsafeMutableRoles(guild.id), r17.roles)
|
|
};
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
GUILD_ROLE_MEMBER_ADD: function handleGuildMemberRoleAdd({ guildId, userId, roleId: roleId2 }) {
|
|
const r5 = env1626[11][guildId];
|
|
if (r5 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(guildId);
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during GUILD_MEMBER_UPDATE.`);
|
|
return false;
|
|
}
|
|
const r9 = r5[userId];
|
|
if (r9 == null) {
|
|
return false;
|
|
}
|
|
if (r9.roles.includes(roleId2)) {
|
|
return false;
|
|
}
|
|
r9.roles = [...r9.roles, roleId2];
|
|
r5[userId] = {
|
|
...r9,
|
|
...computeDerivedMemberState(GuildRoleStore.getUnsafeMutableRoles(guild.id), r9.roles)
|
|
};
|
|
return true;
|
|
},
|
|
GUILD_MEMBER_PROFILE_UPDATE: function handleGuildMemberProfileUpdate({ guildMember, guildId }) {
|
|
const r18 = env1626[11][guildId];
|
|
if (r18 == null) {
|
|
return false;
|
|
}
|
|
const guild = GuildStore.getGuild(guildId);
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during GUILD_MEMBER_UPDATE.`);
|
|
return false;
|
|
}
|
|
L9: {
|
|
r18[guildMember.user.id] = createMember({
|
|
userId: guildMember.user.id,
|
|
nick: guildMember.nick,
|
|
guildId,
|
|
avatar: guildMember.avatar,
|
|
avatarDecoration: parseAvatarDecorationData(guildMember.avatar_decoration_data),
|
|
guildRoles: GuildRoleStore.getUnsafeMutableRoles(guild.id),
|
|
roles: guildMember.roles,
|
|
premiumSince: guildMember.premium_since,
|
|
isPending: guildMember.pending,
|
|
joinedAt: guildMember.joined_at,
|
|
communicationDisabledUntil: guildMember.communication_disabled_until,
|
|
unusualDMActivityUntil: guildMember.unusual_dm_activity_until,
|
|
flags: guildMember.flags,
|
|
fullProfileLoadedTimestamp: Date.now(),
|
|
collectibles: parseServerUserCollectibles(guildMember.collectibles),
|
|
displayNameStyles: parseServerDisplayNameStyles(guildMember.display_name_styles)
|
|
});
|
|
const r56 = r18[guildMember.user.id];
|
|
if (r56.communicationDisabledUntil != null && isMemberCommunicationDisabled(r56)) {
|
|
const userId = r56.userId;
|
|
const r63 = [];
|
|
r63[c1626_24.GUILD] = guildId;
|
|
r63[c1626_24.USER] = userId;
|
|
const r69 = r63.join("-");
|
|
if (!(env1626[15][r69] !== r56.communicationDisabledUntil && isMemberCommunicationDisabled(r56))) {
|
|
break L9;
|
|
}
|
|
env1626[15][r69] = r56.communicationDisabledUntil;
|
|
const r80 = env1626[17] + 1;
|
|
env1626[17] = r80;
|
|
c1626_19[r69] = r80;
|
|
} else {
|
|
removeCommunicationDisabled(guildId, r56.userId);
|
|
}
|
|
}
|
|
},
|
|
IMPERSONATE_UPDATE: handleImpersonateUpdate,
|
|
IMPERSONATE_STOP: handleImpersonateUpdate,
|
|
PASSIVE_UPDATE_V2: function handlePassiveUpdateV2(a0) {
|
|
let r24;
|
|
let r2 = a0.members.length > 0;
|
|
if (r2) {
|
|
let env13371;
|
|
const { guildId, members } = a0;
|
|
const r14 = env13371 = {
|
|
$parent: env1626
|
|
};
|
|
env13371[0] = guildId;
|
|
env13371[1] = void 0;
|
|
env13371[2] = void 0;
|
|
const r15 = env1626[11][guildId];
|
|
env13371[1] = r15;
|
|
const r5 = r15 == null;
|
|
let r16 = false;
|
|
if (!r5) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
env13371[2] = guild;
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during batchUpdateGuildMembers.`);
|
|
r24 = false;
|
|
} else {
|
|
members.forEach($mk70667(r14));
|
|
env1626[18] = env1626[18] + 1;
|
|
r24 = true;
|
|
}
|
|
r16 = r24;
|
|
}
|
|
r2 = r16;
|
|
}
|
|
return r2;
|
|
},
|
|
CLEAR_PENDING_CHANNEL_AND_ROLE_UPDATES: function handleClearPendingUpdates({ guildId }) {
|
|
if (guildId == null) {
|
|
return false;
|
|
}
|
|
delete c1626_20[guildId];
|
|
},
|
|
LOCAL_MESSAGES_LOADED: function handleLocalMessagesLoaded(a0) {
|
|
if (a0.guildId != null && GuildStore.getGuild(a0.guildId) != null) {
|
|
env1626[16] = true;
|
|
const r9 = env1626[11];
|
|
const guildId = a0.guildId;
|
|
let r28 = env1626[11][a0.guildId];
|
|
if (r28 == null) {
|
|
r28 = {};
|
|
}
|
|
r9[guildId] = r28;
|
|
let r29 = false;
|
|
env1626[16] = true;
|
|
const r30 = env1626[11];
|
|
const guildId2 = a0.guildId;
|
|
let r34 = env1626[11][a0.guildId];
|
|
if (r34 == null) {
|
|
r34 = {};
|
|
}
|
|
r30[guildId2] = r34;
|
|
for (const member of a0.members) {
|
|
if (env1626[11][a0.guildId][member.userId] == null) {
|
|
r29 = true;
|
|
const r49 = env1626[11][a0.guildId];
|
|
r49[member.userId] = member;
|
|
}
|
|
}
|
|
return r29;
|
|
}
|
|
return false;
|
|
},
|
|
MESSAGE_CREATE: handleIncomingMessage,
|
|
MESSAGE_UPDATE: handleIncomingMessage,
|
|
LOAD_MESSAGES_SUCCESS: handleLoadMessages,
|
|
LOAD_MESSAGES_AROUND_SUCCESS: handleLoadMessages,
|
|
LOAD_RECENT_MENTIONS_SUCCESS: handleLoadMessages,
|
|
LOAD_PINNED_MESSAGES_SUCCESS: function handleLoadPinnedMessages(a0) {
|
|
a0.pins.forEach((pin) => {
|
|
mergeMessageResolvedMembers(pin.message);
|
|
});
|
|
},
|
|
SEARCH_MESSAGES_SUCCESS: handleLoadSearchResults,
|
|
MOD_VIEW_SEARCH_MESSAGES_SUCCESS: handleLoadSearchResults,
|
|
MEMBER_SAFETY_GUILD_MEMBER_SEARCH_SUCCESS: function hangdleMemberSafetyGuildMemberSearchSuccess(a0) {
|
|
let r23;
|
|
let env13372;
|
|
const guildId = a0.guildId;
|
|
const r12 = a0.members.map((member) => member.member);
|
|
const r13 = env13372 = {
|
|
$parent: env1626
|
|
};
|
|
env13372[0] = guildId;
|
|
env13372[1] = void 0;
|
|
env13372[2] = void 0;
|
|
const r15 = env1626[11][guildId];
|
|
env13372[1] = r15;
|
|
const r4 = r15 == null;
|
|
let r16 = false;
|
|
if (!r4) {
|
|
const guild = GuildStore.getGuild(guildId);
|
|
env13372[2] = guild;
|
|
if (guild == null) {
|
|
c1626_10.warn(`Guild ${guildId} not found during batchUpdateGuildMembers.`);
|
|
r23 = false;
|
|
} else {
|
|
r12.forEach($mk70667(r13));
|
|
env1626[18] = env1626[18] + 1;
|
|
r23 = true;
|
|
}
|
|
r16 = r23;
|
|
}
|
|
return r16;
|
|
},
|
|
EMBEDDED_ACTIVITY_UPDATE_V2: function handleEmbeddedActivityUpdateV2({ instance }) {
|
|
const embeddedActivityLocationGuildId = getEmbeddedActivityLocationGuildId(instance.location);
|
|
return embeddedActivityLocationGuildId != null && buildMembers({
|
|
id: embeddedActivityLocationGuildId,
|
|
members: instance.participants.filter(isActivityParticipantValidGuildMember).map($mk70668())
|
|
});
|
|
},
|
|
INTERACTION_MODAL_CREATE: function handleInteractionModalCreate(a0) {
|
|
const channel = ChannelStore.getChannel(a0.channelId);
|
|
const resolved = a0.resolved;
|
|
const guild_id = channel?.guild_id;
|
|
let env13373;
|
|
const r13 = env13373 = {};
|
|
env13373[0] = resolved;
|
|
return resolved?.members != null && guild_id != null && buildMembers({
|
|
id: guild_id,
|
|
members: Object.entries(resolved.members).map($mk70670(r13)).filter($mk70671())
|
|
});
|
|
}
|
|
});
|
|
export default r146;
|
|
export function getUserCommunicationDisabledVersion(a0, a1) {
|
|
const r4 = [];
|
|
r4[c1626_24.GUILD] = a0;
|
|
r4[c1626_24.USER] = a1;
|
|
const r10 = r4.join("-");
|
|
return r10 in c1626_19 ? c1626_19[r10] : -1;
|
|
}
|
|
export function getCommunicationDisabledUserKey(a0, a1) {
|
|
const r2 = [];
|
|
r2[c1626_24.GUILD] = a0;
|
|
r2[c1626_24.USER] = a1;
|
|
return r2.join("-");
|
|
}
|
|
export function getUserIdFromCommunicationDisabledUserKey(a0) {
|
|
return a0.split("-")[c1626_24.USER];
|
|
}
|
|
export function getGuildIdFromCommunicationDisabledUserKey(a0) {
|
|
return a0.split("-")[c1626_24.GUILD];
|
|
}
|