decord/source/modules/application_commands/DraftCommandUtils.tsx

66 lines
2.3 KiB
TypeScript
Raw Normal View History

// Module ID: 12087
// Function ID: 12088
// Name: DraftCommandUtils
// Dependencies: [5051, 4949, 9507, 2]
2026-08-31 15:47:37 +00:00
// Exports: resolveDraftCommand, toDraftCommand
// Module 12087 (DraftCommandUtils)
import DraftCommand from "DraftCommand" /* 4949 */;
import ChannelAutocompleteConstants from "ChannelAutocompleteConstants" /* 5051 */;
import ApplicationCommandQueryApiAll from "ApplicationCommandQueryApi" /* 9507 */;
import size from "module_2" /* 2 */;
2026-08-31 15:47:37 +00:00
const COMMAND_SENTINEL = ChannelAutocompleteConstants.COMMAND_SENTINEL;
const result = size.fileFinishedImporting("modules/application_commands/DraftCommandUtils.tsx");
2026-08-31 15:47:37 +00:00
2026-09-02 09:53:35 +00:00
export const toDraftCommand = function toDraftCommand(activeCommand, result1) {
2026-08-31 15:47:37 +00:00
if (null == activeCommand) {
return null;
} else {
2026-09-02 09:53:35 +00:00
let tmp2 = (function getCommandTextPrefix(activeCommand, result1) {
2026-08-31 15:47:37 +00:00
const items = [, ];
({ displayName: arr[0], untranslatedName: arr[1] } = activeCommand);
const obj = items[Symbol.iterator]();
while (obj !== undefined) {
let _HermesInternal = HermesInternal;
let combined = "" + COMMAND_SENTINEL + tmp;
2026-09-02 09:53:35 +00:00
if (result1 !== combined) {
2026-08-31 15:47:37 +00:00
let _HermesInternal2 = HermesInternal;
}
obj.return();
return combined;
}
return null;
2026-09-02 09:53:35 +00:00
})(activeCommand, result1);
2026-08-31 15:47:37 +00:00
let tmp3 = null;
if (null != tmp2) {
let obj = { commandId: null, applicationId: null, commandText: null };
({ id: obj.commandId, applicationId: obj.applicationId } = activeCommand);
obj.commandText = tmp2;
2026-08-31 15:47:37 +00:00
tmp3 = obj;
}
return tmp3;
}
};
export const resolveDraftCommand = function resolveDraftCommand(channel, text, draftCommand) {
if (null != draftCommand) {
if (obj4.isDraftCommandValidForText(draftCommand, text)) {
const obj2 = { channel, type: "channel" };
const cachedCommand = ApplicationCommandQueryApiAll.getCachedCommand(obj2, draftCommand.commandId, draftCommand.applicationId);
2026-08-31 15:47:37 +00:00
({ command, section } = cachedCommand);
let tmp4 = null;
if (null != command) {
const obj3 = { command, section: null };
2026-08-31 15:47:37 +00:00
if (section == null) {
section = null;
}
obj3.section = section;
tmp4 = obj3;
2026-08-31 15:47:37 +00:00
}
return tmp4;
}
obj4 = DraftCommand;
2026-08-31 15:47:37 +00:00
}
return null;
};