decord/source/modules/application_commands/native/ApplicationCommandUtils.tsx

82 lines
3.3 KiB
TypeScript
Raw Normal View History

// Module ID: 12235
// Function ID: 12236
2026-07-20 16:05:17 +00:00
// Name: getApplicationCommandsIconSource
// Dependencies: [4901, 4900, 4999, 1396, 12236, 12237, 7523, 1884, 10638, 9312, 2]
2026-07-20 16:05:17 +00:00
// Exports: getApplicationCommandsIconSource, openCommandAttachmentPreview
// Module 12235 (getApplicationCommandsIconSource)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import getAvatarURLDefault from "getAvatarURL" /* 1396 */;
import registerAssetDefault from "registerAsset" /* 1884 */;
import handleChanged from "handleChanged" /* 4901 */;
import TRUE_OPTION_NAME from "TRUE_OPTION_NAME" /* 4999 */;
import ApplicationCommandSectionType from "ApplicationCommandSectionType" /* 7523 */;
import showUploadPreviewActionSheetDefault from "showUploadPreviewActionSheet" /* 10638 */;
import registerAssetDefault2 from "registerAsset" /* 12236 */;
import registerAssetDefault3 from "registerAsset" /* 12237 */;
import closure_4 from "map" /* 4900 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const DraftType = handleChanged.DraftType;
const BuiltInSectionId = TRUE_OPTION_NAME.BuiltInSectionId;
let result = set.fileFinishedImporting("modules/application_commands/native/ApplicationCommandUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getApplicationCommandsIconSource = function getApplicationCommandsIconSource(section, stateFromStores) {
if (null == section) {
return null;
} else {
const id = section.id;
if (BuiltInSectionId.BUILT_IN === id) {
2026-08-24 06:08:38 +00:00
return getAvatarURLDefault.makeSource(registerAssetDefault2);
2026-08-13 17:34:28 +00:00
} else if (tmp10.FRECENCY === id) {
2026-08-24 06:08:38 +00:00
return getAvatarURLDefault.makeSource(registerAssetDefault3);
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
if (section.type === ApplicationCommandSectionType.ApplicationCommandSectionType.APPLICATION) {
let obj = getAvatarURLDefault;
2026-07-29 08:29:29 +00:00
obj = { id: null, icon: null, bot: null, botIconFirst: true, guildMember: null };
({ id: obj2[0], icon: obj2[1], application } = section);
2026-07-20 16:05:17 +00:00
let bot;
2026-07-29 08:29:29 +00:00
if (application != null) {
2026-07-20 16:05:17 +00:00
bot = application.bot;
}
2026-07-29 08:29:29 +00:00
obj[2] = bot;
obj[4] = stateFromStores;
2026-07-20 16:05:17 +00:00
let applicationIconSource = obj.getApplicationIconSource(obj);
} else {
2026-08-24 06:08:38 +00:00
applicationIconSource = registerAssetDefault;
2026-07-20 16:05:17 +00:00
}
return applicationIconSource;
}
}
};
export const openCommandAttachmentPreview = function openCommandAttachmentPreview(applicationCommandManager, channelId, name, fn) {
2026-08-24 06:08:38 +00:00
closure_0 = applicationCommandManager;
importDefault = channelId;
dependencyMap = name;
2026-07-23 10:11:24 +00:00
upload = upload.getUpload(channelId, name, upload.SlashCommand);
2026-07-20 16:05:17 +00:00
if (null != upload) {
2026-07-29 08:29:29 +00:00
const obj = { channelId: null, disableSpoiler: true, onClose: null, onRemove: null, upload: null };
obj[0] = channelId;
obj[2] = fn;
obj[3] = function onRemove() {
channelId(name[9]).remove(channelId, upload.id, upload.SlashCommand);
let found;
if (closure_0 != null) {
const activeCommand = obj2.props.activeCommand;
if (activeCommand != null) {
const options = activeCommand.options;
if (options != null) {
found = options.find((name) => name.name === closure_2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
}
if (null != found) {
if (obj2 != null) {
const result = obj2.insertOrJumpCommandOption(found, undefined, false, { displayText: "" });
}
}
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
obj[4] = upload;
2026-08-24 06:08:38 +00:00
showUploadPreviewActionSheetDefault(obj);
2026-07-20 16:05:17 +00:00
}
};