decord/source/modules/application_commands/DraftCommandUtils.tsx

72 lines
2.3 KiB
TypeScript
Raw Normal View History

// Module ID: 11998
// Function ID: 11999
2026-08-31 15:47:37 +00:00
// Name: toDraftCommand
// Dependencies: [5000, 4903, 9421, 2]
2026-08-31 15:47:37 +00:00
// Exports: resolveDraftCommand, toDraftCommand
// Module 11998 (toDraftCommand)
2026-08-31 15:47:37 +00:00
import set from "set" /* 2 */;
import isDraftCommandValidForText from "isDraftCommandValidForText" /* 4903 */;
import regExp from "regExp" /* 5000 */;
import findCommandInSectionAll from "findCommandInSection" /* 9421 */;
2026-08-31 15:47:37 +00:00
const COMMAND_SENTINEL = regExp.COMMAND_SENTINEL;
const result = set.fileFinishedImporting("modules/application_commands/DraftCommandUtils.tsx");
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 tmp2 = closure_3;
let _HermesInternal = HermesInternal;
let combined = "" + closure_3 + tmp;
2026-09-02 09:53:35 +00:00
if (result1 !== combined) {
2026-08-31 15:47:37 +00:00
let tmp5 = combined;
let _HermesInternal2 = HermesInternal;
}
let tmp6 = obj;
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[0], applicationId: obj[1] } = activeCommand);
obj[2] = tmp2;
tmp3 = obj;
}
return tmp3;
}
};
export const resolveDraftCommand = function resolveDraftCommand(channel, text, draftCommand) {
if (null != draftCommand) {
if (obj4.isDraftCommandValidForText(draftCommand, text)) {
let obj = findCommandInSectionAll;
obj = { channel: null, type: "channel" };
obj[0] = channel;
const cachedCommand = obj.getCachedCommand(obj, draftCommand.commandId, draftCommand.applicationId);
({ command, section } = cachedCommand);
let tmp4 = null;
if (null != command) {
obj = { command: null, section: null };
obj[0] = command;
if (section == null) {
section = null;
}
obj[1] = section;
tmp4 = obj;
}
return tmp4;
}
obj4 = isDraftCommandValidForText;
}
return null;
};