decord/source/modules/application_commands/ApplicationCommandValidationUtils.tsx

93 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 11333
// Function ID: 11334
2026-07-29 08:29:29 +00:00
// Name: validateOptionContent
2026-08-15 05:55:55 +00:00
// Dependencies: [5246, 5248, 10256, 1236, 11334, 2]
2026-07-20 16:05:17 +00:00
// Exports: getValidationResults
2026-08-15 05:55:55 +00:00
// Module 11333 (validateOptionContent)
2026-07-23 10:11:24 +00:00
import { getValidationErrorText } from "TRUE_OPTION_NAME";
2026-07-20 16:05:17 +00:00
function validateOptionContent(allowEmptyValues) {
let channelId;
let commandOrigin;
let content;
let guildId;
let option;
({ option, content, guildId, channelId, commandOrigin } = allowEmptyValues);
if (commandOrigin === undefined) {
2026-08-15 05:55:55 +00:00
commandOrigin = require(5248) /* ApplicationCommandSectionType */.CommandOrigin.CHAT;
2026-07-20 16:05:17 +00:00
}
let str = "";
if (null != content) {
2026-08-15 05:55:55 +00:00
let obj = require(10256) /* getString */;
2026-07-29 08:29:29 +00:00
obj = { content: null };
obj[0] = content;
2026-07-20 16:05:17 +00:00
str = obj.getString(obj, "content").trim();
const str3 = obj.getString(obj, "content");
}
const required = option.required;
if (null == content) {
if (required) {
2026-07-29 08:29:29 +00:00
obj = { success: false, error: null };
const intl2 = require(1236) /* getSystemLocale */.intl;
obj[1] = intl2.string(require(1236) /* getSystemLocale */.t.JZJQL2);
2026-07-20 16:05:17 +00:00
let obj1 = obj;
} else {
obj1 = { success: true };
}
return obj1;
} else if ("" === str) {
if (allowEmptyValues.allowEmptyValues) {
2026-07-29 08:29:29 +00:00
let obj2 = { success: true };
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj3 = { success: false, error: null };
2026-07-20 16:05:17 +00:00
if (required) {
2026-07-29 08:29:29 +00:00
const intl = require(1236) /* getSystemLocale */.intl;
obj3[1] = intl.string(require(1236) /* getSystemLocale */.t.JZJQL2);
obj2 = obj3;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj3[1] = getValidationErrorText(option);
obj2 = obj3;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return obj2;
2026-07-20 16:05:17 +00:00
} else {
if (content.length > 1) {
2026-07-29 08:29:29 +00:00
const obj4 = { type: "text", text: null };
obj4[1] = str;
2026-07-20 16:05:17 +00:00
let first = obj4;
} else {
first = content[0];
}
2026-08-15 05:55:55 +00:00
const tmp8 = importDefault(11334);
2026-07-20 16:05:17 +00:00
const tmp15 = tmp8[option.type](first, option, channelId, guildId, commandOrigin);
if (!tmp16) {
tmp15.error = getValidationErrorText(option);
}
return tmp15;
}
}
2026-07-29 08:29:29 +00:00
const result = require("getString").fileFinishedImporting("modules/application_commands/ApplicationCommandValidationUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const getValidationResults = function getValidationResults(activeCommand, optionValues, guild_id, id, arg4) {
2026-07-20 16:05:17 +00:00
let obj = {};
const options = activeCommand.options;
if (null == options) {
return obj;
} else {
2026-07-29 08:29:29 +00:00
for (const item10012 of options) {
let tmp3 = validateOptionContent;
obj = { option: null, content: null, guildId: null, channelId: null, allowEmptyValues: null };
obj[0] = item10012;
obj[1] = arg1[item10012.name];
obj[2] = arg2;
obj[3] = arg3;
obj[4] = arg4;
obj[item10012.name] = validateOptionContent(obj);
continue;
2026-07-20 16:05:17 +00:00
}
return obj;
}
};
export { validateOptionContent };