decord/alpha/source/modules/application_commands/DraftCommandUtils.tsx
github-actions 45f5884862 chore: update source for alpha 348.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5012.js (118.4 MB)
2026-09-23 06:49:31 +00:00

65 lines
2.3 KiB
TypeScript

// Module ID: 12327
// Function ID: 12328
// Name: DraftCommandUtils
// Dependencies: [5296, 5192, 9609, 2]
// Exports: resolveDraftCommand, toDraftCommand
// Module 12327 (DraftCommandUtils)
import DraftCommand from "DraftCommand" /* 5192 */;
import ChannelAutocompleteConstants from "ChannelAutocompleteConstants" /* 5296 */;
import ApplicationCommandQueryApiAll from "ApplicationCommandQueryApi" /* 9609 */;
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) {
if (null == activeCommand) {
return null;
} else {
let tmp2 = (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;
})(activeCommand, result1);
let tmp3 = null;
if (null != tmp2) {
let obj = { commandId: null, applicationId: null, commandText: null };
({ id: obj.commandId, applicationId: obj.applicationId } = activeCommand);
obj.commandText = tmp2;
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);
({ command, section } = cachedCommand);
let tmp4 = null;
if (null != command) {
const obj3 = { command, section: null };
if (section == null) {
section = null;
}
obj3.section = section;
tmp4 = obj3;
}
return tmp4;
}
obj4 = DraftCommand;
}
return null;
};