decord/source/modules/guild_templates/GuildTemplateStore.tsx

208 lines
6.4 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 7065
// Function ID: 7066
2026-07-29 08:29:29 +00:00
// Name: handleGuildTemplateResolveSuccess
2026-08-25 06:04:03 +00:00
// Dependencies: [6050, 6049, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 7065 (handleGuildTemplateResolveSuccess)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-08-25 06:04:03 +00:00
import createResolvedGuildTemplateDefault from "createResolvedGuildTemplate" /* 6049 */;
import GUILD_TEMPLATES_MEMBER_COUNT_PROMOTION_THRESHOLD from "GUILD_TEMPLATES_MEMBER_COUNT_PROMOTION_THRESHOLD" /* 6050 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
function handleGuildTemplateResolveSuccess(guildTemplate) {
guildTemplate = guildTemplate.guildTemplate;
const code = guildTemplate.code;
if (null != code) {
const value = map.get(code);
if (null != value) {
let obj = {};
const merged = Object.assign(value);
} else {
obj = { code: null, state: null };
obj[0] = code;
obj[1] = GuildTemplateStates.RESOLVING;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const tmp7 = createResolvedGuildTemplateDefault(guildTemplate);
2026-07-29 08:29:29 +00:00
for (const key10019 in tmp7) {
let tmp17 = key10019;
obj[key10019] = tmp7[key10019];
continue;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const _Map = Map;
map = new Map(map);
const result = map.set(code, obj);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
function handleGuildTemplateResolveFailure(code) {
code = code.code;
2026-07-20 16:05:17 +00:00
if (null != code) {
let value = map.get(code);
if (null != value) {
let obj = {};
const merged = Object.assign(value);
} else {
2026-07-29 08:29:29 +00:00
obj = { code: null, state: null };
obj[0] = code;
obj[1] = GuildTemplateStates.RESOLVING;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.state = GuildTemplateStates.EXPIRED;
2026-07-20 16:05:17 +00:00
const _Map = Map;
value = new.target;
2026-07-23 10:11:24 +00:00
map = new Map(map);
2026-07-20 16:05:17 +00:00
const result = map.set(code, obj);
}
}
2026-08-24 06:08:38 +00:00
const GuildTemplateStates = GUILD_TEMPLATES_MEMBER_COUNT_PROMOTION_THRESHOLD.GuildTemplateStates;
2026-07-23 10:11:24 +00:00
let map = new Map();
2026-07-29 08:29:29 +00:00
let c4 = null;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class GuildTemplateStore extends Store {
}
const prototype = GuildTemplateStore.prototype;
prototype["getGuildTemplate"] = function getGuildTemplate(code) {
if (null != code) {
return map.get(code);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
prototype["getGuildTemplates"] = function getGuildTemplates() {
return map;
};
prototype["getForGuild"] = function getForGuild(arg0) {
const keys = map.keys();
const obj = keys[Symbol.iterator]();
while (obj !== undefined) {
let tmp3 = map;
let value = map.get(tmp2);
let tmp5 = value;
if (null != value) {
let tmp6 = value;
if ("sourceGuildId" in tmp5) {
let tmp7 = value;
if (tmp5.sourceGuildId === arg0) {
let tmp8 = value;
let tmp9 = GuildTemplateStates;
if (tmp5.state !== GuildTemplateStates.EXPIRED) {
let tmp10 = obj;
obj.return();
return value;
2026-07-20 16:05:17 +00:00
}
}
}
}
2026-07-29 08:29:29 +00:00
continue;
}
};
prototype["getDisplayedGuildTemplateCode"] = function getDisplayedGuildTemplateCode() {
return c4;
};
GuildTemplateStore.displayName = "GuildTemplateStore";
2026-08-24 06:08:38 +00:00
const guildTemplateStore = new GuildTemplateStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
GUILD_TEMPLATE_RESOLVE: function handleGuildTemplateResolve(code) {
code = code.code;
2026-07-23 10:11:24 +00:00
map = new Map(map);
2026-07-20 16:05:17 +00:00
const result = map.set(code, { code, state: GuildTemplateStates.RESOLVING });
},
GUILD_TEMPLATE_CREATE_SUCCESS: handleGuildTemplateResolveSuccess,
GUILD_TEMPLATE_SYNC_SUCCESS: handleGuildTemplateResolveSuccess,
GUILD_TEMPLATE_RESOLVE_SUCCESS: handleGuildTemplateResolveSuccess,
GUILD_TEMPLATE_LOAD_FOR_GUILD_SUCCESS: function handleGuildTemplateLoadForGuildSuccess(guildTemplates) {
guildTemplates = guildTemplates.guildTemplates;
2026-07-29 08:29:29 +00:00
const item = guildTemplates.forEach((code) => {
code = code.code;
if (null != code) {
const value = map.get(code);
if (null != value) {
let obj = {};
const merged = Object.assign(value);
} else {
obj = { code: null, state: null };
obj[0] = code;
obj[1] = constants.RESOLVING;
}
const tmp7 = callback(table[1])(code);
for (const key10018 in tmp7) {
let tmp17 = key10018;
obj[key10018] = tmp7[key10018];
continue;
}
const _Map = Map;
map = new Map(map);
const result = map.set(code, obj);
}
2026-07-20 16:05:17 +00:00
});
},
GUILD_TEMPLATE_RESOLVE_FAILURE: handleGuildTemplateResolveFailure,
GUILD_TEMPLATE_DELETE_SUCCESS: handleGuildTemplateResolveFailure,
GUILD_TEMPLATE_ACCEPT: function handleGuildTemplateAccept(code) {
2026-07-29 08:29:29 +00:00
code = code.code;
if (null != code) {
let value = map.get(code);
if (null != value) {
let obj = {};
const merged = Object.assign(value);
} else {
obj = { code: null, state: null };
obj[0] = code;
obj[1] = GuildTemplateStates.RESOLVING;
}
obj.state = GuildTemplateStates.ACCEPTING;
const _Map = Map;
value = new.target;
map = new Map(map);
const result = map.set(code, obj);
}
2026-07-20 16:05:17 +00:00
},
GUILD_TEMPLATE_ACCEPT_SUCCESS: function handleGuildTemplateAcceptSuccess(code) {
2026-07-29 08:29:29 +00:00
code = code.code;
if (null != code) {
const value = map.get(code);
if (null != value) {
let obj = {};
const merged = Object.assign(value);
} else {
obj = { code: null, state: null };
obj[0] = code;
obj[1] = GuildTemplateStates.RESOLVING;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.state = GuildTemplateStates.ACCEPTED;
let num = obj.usageCount;
if (num == null) {
num = 0;
}
obj.usageCount = num + 1;
const _Map = Map;
map = new Map(map);
const result = map.set(code, obj);
}
2026-07-20 16:05:17 +00:00
},
GUILD_TEMPLATE_ACCEPT_FAILURE: function handleAcceptInviteFailure(code) {
2026-07-29 08:29:29 +00:00
code = code.code;
if (null != code) {
let value = map.get(code);
if (null != value) {
let obj = {};
const merged = Object.assign(value);
} else {
obj = { code: null, state: null };
obj[0] = code;
obj[1] = GuildTemplateStates.RESOLVING;
}
obj.state = GuildTemplateStates.RESOLVED;
const _Map = Map;
value = new.target;
map = new Map(map);
const result = map.set(code, obj);
}
2026-07-20 16:05:17 +00:00
},
GUILD_TEMPLATE_MODAL_SHOW: function handleGuildTemplateModalShow(code) {
code = code.code;
},
GUILD_TEMPLATE_MODAL_HIDE: function handleGuildTemplateModalHide() {
2026-08-24 06:08:38 +00:00
c4 = null;
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
let result = set.fileFinishedImporting("modules/guild_templates/GuildTemplateStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default guildTemplateStore;