68 lines
2.3 KiB
TypeScript
68 lines
2.3 KiB
TypeScript
// Module ID: 11608
|
|
// Function ID: 11609
|
|
// Name: DraftCommandUtils
|
|
// Dependencies: [5789, 7032, 8939, 2]
|
|
// Exports: resolveDraftCommand, toDraftCommand
|
|
|
|
// Module 11608 (DraftCommandUtils)
|
|
import ChannelAutocompleteConstants from "ChannelAutocompleteConstants" /* 5789 */;
|
|
import DraftCommand from "DraftCommand" /* 7032 */;
|
|
import ApplicationCommandQueryApiAll from "ApplicationCommandQueryApi" /* 8939 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const COMMAND_SENTINEL = ChannelAutocompleteConstants.COMMAND_SENTINEL;
|
|
const result = size.fileFinishedImporting("modules/application_commands/DraftCommandUtils.tsx");
|
|
|
|
export const toDraftCommand = function toDraftCommand(activeCommand, result1) {
|
|
function getCommandTextPrefix(activeCommand, result1) {
|
|
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;
|
|
if (result1 !== combined) {
|
|
let _HermesInternal2 = HermesInternal;
|
|
}
|
|
obj.return();
|
|
return combined;
|
|
}
|
|
return null;
|
|
}
|
|
if (null == activeCommand) {
|
|
return null;
|
|
} else {
|
|
const tmp = result1;
|
|
let tmp2 = getCommandTextPrefix(activeCommand, result1);
|
|
let tmp3 = null;
|
|
if (null != tmp2) {
|
|
let obj = { commandId: null, applicationId: null, commandText: tmp2 };
|
|
({ id: obj.commandId, applicationId: obj.applicationId } = activeCommand);
|
|
tmp3 = obj;
|
|
}
|
|
return tmp3;
|
|
}
|
|
};
|
|
export const resolveDraftCommand = function resolveDraftCommand(channel, text, draftCommand) {
|
|
let command;
|
|
let section;
|
|
if (null != draftCommand) {
|
|
const obj4 = DraftCommand;
|
|
if (obj4.isDraftCommandValidForText(draftCommand, text)) {
|
|
const obj2 = { channel, type: "channel" };
|
|
const obj = ApplicationCommandQueryApiAll;
|
|
const cachedCommand = obj.getCachedCommand(obj2, draftCommand.commandId, draftCommand.applicationId);
|
|
({ command, section } = cachedCommand);
|
|
let tmp4 = null;
|
|
if (null != command) {
|
|
const obj3 = { command, section };
|
|
if (section == null) {
|
|
section = null;
|
|
}
|
|
tmp4 = obj3;
|
|
}
|
|
return tmp4;
|
|
}
|
|
}
|
|
return null;
|
|
};
|