decord/alpha/source/stores/WebhooksStore.tsx

141 lines
3.9 KiB
TypeScript
Raw Permalink Normal View History

2026-10-13 12:43:34 +00:00
// Module ID: 17609
// Function ID: 17610
// Name: WebhooksStore
2026-10-13 12:43:34 +00:00
// Dependencies: [17610, 12, 504, 584, 2]
2026-07-23 10:11:24 +00:00
2026-10-13 12:43:34 +00:00
// Module 17609 (WebhooksStore)
import _modDef12 from "module_12" /* 12 */;
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-13 12:43:34 +00:00
import WebhooksActionCreatorsDefault from "WebhooksActionCreators" /* 17610 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
let c2;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
function handleWebhookCreateUpdate(arg0) {
2026-10-03 08:58:59 +00:00
let guildId;
let webhook;
2026-07-29 08:29:29 +00:00
({ guildId, webhook } = arg0);
2026-10-03 08:58:59 +00:00
if (null == closure_3[guildId]) {
closure_3[guildId] = {};
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
closure_3[guildId][webhook.id] = webhook;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const _false = {};
2026-07-29 08:29:29 +00:00
let closure_4 = {};
2026-10-03 08:58:59 +00:00
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class WebhooksStore extends Store {
2026-10-03 08:58:59 +00:00
isFetching(arg0, arg1) {
let str = arg1;
const tmp = closure_4;
if (null == arg1) {
str = "guild";
}
return null != tmp["" + arg0 + ":" + str];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getWebhooksForGuild(id) {
const values = _modDef12.values;
_modDef12;
if (null == closure_3[id]) {
closure_3[id] = {};
}
return values(closure_3[id]);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getWebhooksForChannel(id, arg1) {
let closure_0 = arg1;
const tmp = _modDef12;
if (null == closure_3[id]) {
closure_3[id] = {};
}
const tmpResult = tmp(closure_3[id]);
const values = tmpResult.values();
const iter = values.filter((channel_id) => channel_id.channel_id === closure_0);
return iter.value();
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
}
Object.defineProperty(WebhooksStore.prototype, "error", {
2026-07-29 08:29:29 +00:00
get: function error() {
return c2;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
WebhooksStore.displayName = "WebhooksStore";
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
WEBHOOKS_UPDATE: function handleWebhooksUpdate(arg0) {
2026-10-03 08:58:59 +00:00
let channelId;
let error;
let guildId;
let webhooks;
2026-07-20 16:05:17 +00:00
({ guildId, channelId } = arg0);
({ webhooks, error } = arg0);
let obj2;
2026-07-20 16:05:17 +00:00
if (null != webhooks) {
2026-08-24 06:08:38 +00:00
c2 = null;
2026-07-20 16:05:17 +00:00
let items = [];
if (null != channelId) {
2026-10-03 08:58:59 +00:00
const tmp10 = _modDef12;
if (null == closure_3[guildId]) {
closure_3[guildId] = {};
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp10Result = tmp10(closure_3[guildId]);
const values = tmp10Result.values();
2026-07-20 16:05:17 +00:00
const iter = values.filter((channel_id) => channel_id.channel_id !== channelId);
2026-10-03 08:58:59 +00:00
items = iter.value();
2026-07-20 16:05:17 +00:00
}
obj2 = {};
2026-10-03 08:58:59 +00:00
closure_3[guildId] = obj2;
2026-07-20 16:05:17 +00:00
const combined = items.concat(webhooks);
const item = combined.forEach((id) => {
obj2[id.id] = id;
2026-07-20 16:05:17 +00:00
return id;
});
2026-07-29 08:29:29 +00:00
let str4 = channelId;
2026-10-03 08:58:59 +00:00
const tmp14 = closure_4;
2026-07-29 08:29:29 +00:00
if (null == channelId) {
str4 = "guild";
}
const _HermesInternal2 = HermesInternal;
2026-10-03 08:58:59 +00:00
delete tmp14["" + guildId + ":" + str4];
2026-07-20 16:05:17 +00:00
} else if (null != error) {
2026-07-29 08:29:29 +00:00
c2 = error;
let str = channelId;
2026-10-03 08:58:59 +00:00
const tmp6 = closure_4;
2026-07-29 08:29:29 +00:00
if (null == channelId) {
str = "guild";
}
const _HermesInternal = HermesInternal;
2026-10-03 08:58:59 +00:00
delete tmp6["" + guildId + ":" + str];
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
const tmp = null != channelId && null != closure_3[guildId];
if (tmp) {
2026-07-29 08:29:29 +00:00
c2 = null;
2026-10-03 08:58:59 +00:00
const obj = WebhooksActionCreatorsDefault;
const forChannel = obj.fetchForChannel(guildId, channelId);
2026-07-20 16:05:17 +00:00
}
}
},
2026-07-29 08:29:29 +00:00
WEBHOOKS_FETCHING: function handleWebhooksFetching(channelId) {
let str = channelId.channelId;
2026-10-03 08:58:59 +00:00
const guildId = channelId.guildId;
const tmp = closure_4;
2026-07-29 08:29:29 +00:00
if (null == str) {
str = "guild";
}
2026-10-03 08:58:59 +00:00
tmp["" + guildId + ":" + str] = true;
2026-07-20 16:05:17 +00:00
},
WEBHOOK_CREATE: handleWebhookCreateUpdate,
WEBHOOK_UPDATE: handleWebhookCreateUpdate,
2026-10-03 08:58:59 +00:00
WEBHOOK_DELETE: function handleWebhookDelete(guildId) {
guildId = guildId.guildId;
const webhookId = guildId.webhookId;
if (null == closure_3[guildId]) {
closure_3[guildId] = {};
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
delete closure_3[guildId][webhookId];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
};
const webhooksStore = new WebhooksStore(DispatcherDefault, obj);
const result = size.fileFinishedImporting("stores/WebhooksStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default webhooksStore;