decord/source/modules/application_commands/ApplicationCommandChoiceUtils.tsx
2026-08-13 07:00:46 +00:00

75 lines
2.5 KiB
TypeScript

// Module ID: 10042
// Function ID: 10043
// Name: toChoiceBooleanValue
// Dependencies: [7283, 4778, 2]
// Exports: findAutocompleteChoiceNumberValue, findAutocompleteChoiceStringValue, findChoiceNumberValue, findChoiceStringValue, toChoiceBooleanValue
// Module 10042 (toChoiceBooleanValue)
import handleInit from "handleInit";
import TRUE_OPTION_NAME from "TRUE_OPTION_NAME";
let closure_1;
let obj1;
({ FALSE_OPTION_NAME: closure_1, TRUE_OPTION_NAME: obj1 } = TRUE_OPTION_NAME);
const result = require("set").fileFinishedImporting("modules/application_commands/ApplicationCommandChoiceUtils.tsx");
export const toChoiceBooleanValue = function toChoiceBooleanValue(trimmed) {
const formatted = trimmed.toLowerCase();
const tmp2 = formatted === closure_2.toLowerCase();
const formatted1 = trimmed.toLowerCase();
return tmp2;
};
export const findChoiceStringValue = function findChoiceStringValue(choices, closure_27) {
let handleInit = closure_27;
let value;
if (choices != null) {
const iter = choices.find((displayName) => displayName.displayName === handleInit);
if (iter != null) {
value = iter.value;
}
}
return typeof value === "string" ? value : undefined;
};
export const findChoiceNumberValue = function findChoiceNumberValue(choices, trimmed) {
let handleInit = trimmed;
let value;
if (choices != null) {
const iter = choices.find((displayName) => displayName.displayName === handleInit);
if (iter != null) {
value = iter.value;
}
}
return typeof value === "number" ? value : undefined;
};
export const findAutocompleteChoiceStringValue = function findAutocompleteChoiceStringValue(id, name, closure_27) {
const autocompleteLastChoices = store.getAutocompleteLastChoices(id, name);
store = closure_27;
let value;
if (autocompleteLastChoices != null) {
const iter = autocompleteLastChoices.find((displayName) => displayName.displayName === handleInit);
if (iter != null) {
value = iter.value;
}
}
let tmp2;
if (typeof value === "string") {
tmp2 = value;
}
return tmp2;
};
export const findAutocompleteChoiceNumberValue = function findAutocompleteChoiceNumberValue(id, name, trimmed) {
const autocompleteLastChoices = store.getAutocompleteLastChoices(id, name);
store = trimmed;
let value;
if (autocompleteLastChoices != null) {
const iter = autocompleteLastChoices.find((displayName) => displayName.displayName === handleInit);
if (iter != null) {
value = iter.value;
}
}
let tmp2;
if (typeof value === "number") {
tmp2 = value;
}
return tmp2;
};