decord/source/actions/AuditLogActionCreators.tsx

162 lines
6.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 16860
// Function ID: 16861
2026-07-29 08:29:29 +00:00
// Name: makeRequest
2026-08-24 06:08:38 +00:00
// Dependencies: [16850, 676, 530, 709, 2]
2026-07-29 08:29:29 +00:00
// Exports: fetchLogs, fetchNextLogPage, filterByAction, filterByTargetId, filterByUserId
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 16860 (makeRequest)
import sendRequest from "sendRequest" /* 530 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import closure_3 from "AuditLogActions" /* 16850 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function makeRequest(arg0, arg1) {
({ before, userId, targetId, action } = arg1);
2026-07-29 08:29:29 +00:00
if (userId == null) {
2026-08-24 06:08:38 +00:00
userId = closure_3.userIdFilter;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (action == null) {
2026-08-24 06:08:38 +00:00
action = closure_3.actionFilter;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (targetId == null) {
2026-08-24 06:08:38 +00:00
targetId = closure_3.targetIdFilter;
2026-07-20 16:05:17 +00:00
}
let obj = { limit: closure_5 };
if (null != before) {
obj.before = before;
}
if (null != userId) {
obj.user_id = userId;
}
if (null != action) {
obj.action_type = action;
}
if (null != targetId) {
obj.target_id = targetId;
}
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
2026-07-20 16:05:17 +00:00
obj = { url: closure_4.GUILD_AUDIT_LOG(arg0), query: obj, oldFormErrors: true, rejectWithError: true };
return HTTP.get(obj);
}
2026-07-29 08:29:29 +00:00
({ Endpoints: c4, AUDIT_LOG_PAGE_LIMIT: c5 } = ME);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("actions/AuditLogActionCreators.tsx");
2026-07-29 08:29:29 +00:00
export const fetchLogs = function fetchLogs(guildId) {
if (!tmp) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj.dispatch({ type: "AUDIT_LOG_FETCH_START" });
obj = { userId: null, action: null, targetId: null };
obj[0] = arg1;
obj[1] = arg3;
obj[2] = arg2;
2026-07-20 16:05:17 +00:00
return makeRequest(guildId, obj).then((body) => {
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
2026-07-29 08:29:29 +00:00
callback(709).dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => callback(709).dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
};
2026-07-20 16:05:17 +00:00
export const fetchNextLogPage = function fetchNextLogPage(guildId) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
2026-08-24 06:08:38 +00:00
if (closure_3.hasOlderLogs) {
2026-07-29 08:29:29 +00:00
if (!tmp2) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-07-29 08:29:29 +00:00
const logs = tmp.logs;
2026-07-20 16:05:17 +00:00
let id = null;
if (null != logs[logs.length - 1]) {
2026-07-29 08:29:29 +00:00
id = tmp10.id;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj = { type: "AUDIT_LOG_FETCH_NEXT_PAGE_START", before: null, isGroupedFetch: null };
obj[1] = id;
obj[2] = flag;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
obj = { before: null };
obj[0] = id;
2026-07-20 16:05:17 +00:00
return makeRequest(guildId, obj).then((body) => {
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
2026-07-29 08:29:29 +00:00
callback(709).dispatch({ type: "AUDIT_LOG_FETCH_NEXT_PAGE_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => callback(709).dispatch({ type: "AUDIT_LOG_FETCH_NEXT_PAGE_FAIL" }));
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
tmp2 = tmp.isLoading || tmp.isLoadingNextPage;
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
export const filterByAction = function filterByAction(arg0, guildId) {
if (!tmp2) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-07-29 08:29:29 +00:00
let obj = { type: "AUDIT_LOG_FILTER_BY_ACTION", action: null };
obj[1] = arg0;
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch(obj);
2026-07-29 08:29:29 +00:00
let nextPromise;
if (!tmp5) {
if (null != guildId) {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_START" });
2026-07-29 08:29:29 +00:00
obj = { userId: null, action: null, targetId: null };
obj[1] = arg0;
2026-08-24 06:08:38 +00:00
const tmp10Result = dispatcherDefault;
2026-07-29 08:29:29 +00:00
nextPromise = makeRequest(guildId, obj).then((body) => {
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
callback(709).dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => callback(709).dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
const promise = makeRequest(guildId, obj);
}
}
return nextPromise;
2026-07-20 16:05:17 +00:00
}
}
};
export const filterByUserId = function filterByUserId(id, guildId) {
2026-07-29 08:29:29 +00:00
if (!tmp2) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
2026-07-29 08:29:29 +00:00
let obj = { type: "AUDIT_LOG_FILTER_BY_USER", userId: null };
obj[1] = id;
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch(obj);
2026-07-29 08:29:29 +00:00
let nextPromise;
if (!tmp5) {
if (null != guildId) {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_START" });
obj = { userId: null, action: "Array", targetId: "applicationId" };
2026-07-29 08:29:29 +00:00
obj[0] = id;
2026-08-24 06:08:38 +00:00
const tmp10Result = dispatcherDefault;
2026-07-29 08:29:29 +00:00
nextPromise = makeRequest(guildId, obj).then((body) => {
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
callback(709).dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => callback(709).dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
const promise = makeRequest(guildId, obj);
}
}
return nextPromise;
2026-07-20 16:05:17 +00:00
}
}
};
2026-07-29 08:29:29 +00:00
export const filterByTargetId = function filterByTargetId(arg0, arg1) {
if (!tmp2) {
if (null != arg1) {
let obj = { type: "AUDIT_LOG_FILTER_BY_TARGET", targetId: null };
obj[1] = arg0;
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch(obj);
2026-07-29 08:29:29 +00:00
let nextPromise;
if (!tmp5) {
if (null != arg1) {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "AUDIT_LOG_FETCH_START" });
obj = { userId: null, action: "Array", targetId: -1 };
2026-07-29 08:29:29 +00:00
obj[2] = arg0;
2026-08-24 06:08:38 +00:00
const tmp10Result = dispatcherDefault;
2026-07-29 08:29:29 +00:00
nextPromise = makeRequest(arg1, obj).then((body) => {
({ audit_log_entries, integrations, users, webhooks, guild_scheduled_events, auto_moderation_rules, threads, application_commands } = body.body);
callback(709).dispatch({ type: "AUDIT_LOG_FETCH_SUCCESS", logs: audit_log_entries, integrations, users, webhooks, guildScheduledEvents: guild_scheduled_events, automodRules: auto_moderation_rules, threads, applicationCommands: application_commands });
}, () => callback(709).dispatch({ type: "AUDIT_LOG_FETCH_FAIL" }));
const promise = makeRequest(arg1, obj);
}
}
return nextPromise;
2026-07-20 16:05:17 +00:00
}
}
};