decord/source/modules/application_commands/ApplicationCommandChoiceUtils.tsx

52 lines
2 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 7960
2026-07-27 11:26:19 +00:00
// Function ID: 63370
2026-07-20 16:05:17 +00:00
// Name: findChoiceStringValue
2026-07-25 08:10:48 +00:00
// Dependencies: [6038, 4567, 2]
2026-07-20 16:05:17 +00:00
// Exports: findAutocompleteChoiceNumberValue, findAutocompleteChoiceStringValue, toChoiceBooleanValue
2026-07-25 08:10:48 +00:00
// Module 7960 (findChoiceStringValue)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import TRUE_OPTION_NAME from "TRUE_OPTION_NAME";
let closure_1;
let closure_2;
2026-07-20 16:05:17 +00:00
function findChoiceStringValue(choices, surrogate) {
2026-07-23 10:11:24 +00:00
let _isNativeReflectConstruct = surrogate;
2026-07-20 16:05:17 +00:00
let value;
if (null != choices) {
2026-07-23 10:11:24 +00:00
const iter = choices.find((displayName) => displayName.displayName === _isNativeReflectConstruct);
2026-07-20 16:05:17 +00:00
if (null != iter) {
value = iter.value;
}
}
return "string" === typeof value ? value : undefined;
}
function findChoiceNumberValue(choices, source) {
2026-07-23 10:11:24 +00:00
let _isNativeReflectConstruct = source;
2026-07-20 16:05:17 +00:00
let value;
if (null != choices) {
2026-07-23 10:11:24 +00:00
const iter = choices.find((displayName) => displayName.displayName === _isNativeReflectConstruct);
2026-07-20 16:05:17 +00:00
if (null != iter) {
value = iter.value;
}
}
return "number" === typeof value ? value : undefined;
}
2026-07-23 10:11:24 +00:00
({ FALSE_OPTION_NAME: closure_1, TRUE_OPTION_NAME: closure_2 } = TRUE_OPTION_NAME);
const result = require("set").fileFinishedImporting("modules/application_commands/ApplicationCommandChoiceUtils.tsx");
2026-07-20 16:05:17 +00:00
export const toChoiceBooleanValue = function toChoiceBooleanValue(trimmed) {
const formatted = trimmed.toLowerCase();
const tmp2 = formatted === closure_2.toLowerCase();
const formatted1 = trimmed.toLowerCase();
return tmp2;
};
export { findChoiceStringValue };
export { findChoiceNumberValue };
export const findAutocompleteChoiceStringValue = function findAutocompleteChoiceStringValue(id, name, surrogate) {
return findChoiceStringValue(store.getAutocompleteLastChoices(id, name), surrogate);
};
export const findAutocompleteChoiceNumberValue = function findAutocompleteChoiceNumberValue(id, name, source) {
return findChoiceNumberValue(store.getAutocompleteLastChoices(id, name), source);
};