decord/alpha/source/stores/GuildMemberCountStore.tsx

109 lines
2.8 KiB
TypeScript
Raw Permalink Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 5020
// Function ID: 5021
// Name: GuildMemberCountStore
2026-10-03 08:58:59 +00:00
// Dependencies: [504, 584, 2]
2026-07-23 10:11:24 +00:00
2026-10-10 08:08:14 +00:00
// Module 5020 (GuildMemberCountStore)
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
function handleInviteData(invite) {
2026-10-03 08:58:59 +00:00
let approximate_presence_count;
let guild;
2026-07-20 16:05:17 +00:00
({ 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 = {};
2026-10-03 08:58:59 +00:00
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class GuildMemberCountStore extends Store {
2026-10-03 08:58:59 +00:00
getMemberCounts() {
return obj;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getMemberCount(arg0) {
let tmp = null;
if (null != arg0) {
tmp = obj[arg0];
}
return tmp;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getOnlineCount(arg0) {
let tmp = null;
if (null != arg0) {
tmp = closure_1[arg0];
}
return tmp;
}
}
const prototype = GuildMemberCountStore.prototype;
2026-07-29 08:29:29 +00:00
GuildMemberCountStore.displayName = "GuildMemberCountStore";
obj = {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen(guilds) {
guilds = guilds.guilds;
2026-10-03 08:58:59 +00:00
obj = {};
2026-07-20 16:05:17 +00:00
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]) {
2026-10-03 08:58:59 +00:00
if (null == closure_1[guild.id]) {
2026-07-20 16:05:17 +00:00
return false;
}
}
2026-10-03 08:58:59 +00:00
delete obj[guild.id];
delete closure_1[guild.id];
2026-07-20 16:05:17 +00:00
},
GUILD_MEMBER_LIST_UPDATE: function handleGuildMemberListUpdate(arg0) {
2026-10-03 08:58:59 +00:00
let guildId;
let memberCount;
let onlineCount;
2026-07-20 16:05:17 +00:00
({ guildId, memberCount, onlineCount } = arg0);
let flag = false;
if (obj[guildId] !== memberCount) {
obj[guildId] = memberCount;
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-10-03 08:58:59 +00:00
if (closure_1[guildId] !== onlineCount) {
closure_1[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) {
2026-10-03 08:58:59 +00:00
let count;
let guildId;
2026-07-20 16:05:17 +00:00
({ 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 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;