decord/alpha/source/stores/GuildMemberCountStore.tsx

102 lines
2.7 KiB
TypeScript
Raw Normal View History

// Module ID: 4676
// Function ID: 4677
// Name: GuildMemberCountStore
// Dependencies: [504, 573, 2]
2026-07-23 10:11:24 +00:00
// Module 4676 (GuildMemberCountStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
2026-07-20 16:05:17 +00:00
function handleInviteData(invite) {
({ guild, approximate_presence_count } = invite.invite);
let id;
2026-07-29 08:29:29 +00:00
if (guild != null) {
2026-07-20 16:05:17 +00:00
id = guild.id;
}
if (null != id) {
if (null != approximate_presence_count) {
2026-07-29 08:29:29 +00:00
closure_1[guild.id] = approximate_presence_count;
2026-07-20 16:05:17 +00:00
}
}
return false;
}
let obj = {};
const dependencyMap = {};
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class GuildMemberCountStore extends Store {
}
const prototype = GuildMemberCountStore.prototype;
prototype["getMemberCounts"] = function getMemberCounts() {
return obj;
2026-07-29 08:29:29 +00:00
};
prototype["getMemberCount"] = function getMemberCount(arg0) {
let tmp = null;
if (null != arg0) {
tmp = obj[arg0];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
};
prototype["getOnlineCount"] = function getOnlineCount(arg0) {
let tmp = null;
if (null != arg0) {
tmp = dependencyMap[arg0];
2026-07-29 08:29:29 +00:00
}
return tmp;
};
GuildMemberCountStore.displayName = "GuildMemberCountStore";
obj = {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen(guilds) {
guilds = guilds.guilds;
const item = guilds.forEach((id) => {
obj[id.id] = id.member_count;
2026-07-20 16:05:17 +00:00
});
},
OVERLAY_INITIALIZE: function handleOverlayInitialize(guildMemberCounts) {
obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(guildMemberCounts.guildMemberCounts);
},
GUILD_CREATE: function handleGuildCreate(guild) {
guild = guild.guild;
obj[guild.id] = guild.member_count;
2026-07-20 16:05:17 +00:00
},
GUILD_DELETE: function handleGuildDelete(guild) {
guild = guild.guild;
if (null == obj[guild.id]) {
if (null == dependencyMap[guild.id]) {
2026-07-20 16:05:17 +00:00
return false;
}
}
2026-07-23 10:11:24 +00:00
delete tmp4[tmp3];
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
},
GUILD_MEMBER_LIST_UPDATE: function handleGuildMemberListUpdate(arg0) {
({ guildId, memberCount, onlineCount } = arg0);
let flag = false;
if (obj[guildId] !== memberCount) {
obj[guildId] = memberCount;
2026-07-20 16:05:17 +00:00
flag = true;
}
if (dependencyMap[guildId] !== onlineCount) {
dependencyMap[guildId] = onlineCount;
2026-07-20 16:05:17 +00:00
flag = true;
}
return flag;
},
INVITE_ACCEPT_SUCCESS: handleInviteData,
INVITE_RESOLVE_SUCCESS: handleInviteData,
ONLINE_GUILD_MEMBER_COUNT_UPDATE: function handleOnlineCountUpdate(arg0) {
({ guildId, count } = arg0);
if (null != guildId) {
if (null != count) {
2026-07-29 08:29:29 +00:00
closure_1[guildId] = count;
2026-07-20 16:05:17 +00:00
}
}
return false;
}
};
const guildMemberCountStore = new GuildMemberCountStore(DispatcherDefault, obj);
const size = fn(2);
const result = size.fileFinishedImporting("stores/GuildMemberCountStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default guildMemberCountStore;