decord/alpha/source/modules/application_commands/ApplicationCommandChoiceUtils.tsx

77 lines
2.7 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 9805
// Function ID: 9806
// Name: ApplicationCommandChoiceUtils
2026-10-12 06:59:38 +00:00
// Dependencies: [7921, 5403, 2]
2026-07-29 08:29:29 +00:00
// Exports: findAutocompleteChoiceNumberValue, findAutocompleteChoiceStringValue, findChoiceNumberValue, findChoiceStringValue, toChoiceBooleanValue
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 9805 (ApplicationCommandChoiceUtils)
import ApplicationCommandAutocompleteStore from "ApplicationCommandAutocompleteStore" /* 7921 */;
2026-10-10 08:08:14 +00:00
import ApplicationCommandConstants from "ApplicationCommandConstants" /* 5403 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let c2;
let map;
({ FALSE_OPTION_NAME: map, TRUE_OPTION_NAME: c2 } = ApplicationCommandConstants);
const result = size.fileFinishedImporting("modules/application_commands/ApplicationCommandChoiceUtils.tsx");
2026-07-29 08:29:29 +00:00
export const toChoiceBooleanValue = function toChoiceBooleanValue(trimmed) {
const formatted = trimmed.toLowerCase();
const tmp2 = formatted === React2.toLowerCase();
2026-07-29 08:29:29 +00:00
const formatted1 = trimmed.toLowerCase();
return tmp2;
};
export const findChoiceStringValue = function findChoiceStringValue(choices, surrogate) {
2026-10-03 08:58:59 +00:00
let closure_0 = surrogate;
let value;
2026-07-29 08:29:29 +00:00
if (choices != null) {
2026-08-24 06:08:38 +00:00
const iter = choices.find((displayName) => displayName.displayName === closure_0);
2026-07-29 08:29:29 +00:00
if (iter != null) {
2026-07-20 16:05:17 +00:00
value = iter.value;
}
}
2026-08-04 21:03:28 +00:00
return typeof value === "string" ? value : undefined;
2026-07-29 08:29:29 +00:00
};
export const findChoiceNumberValue = function findChoiceNumberValue(choices, trimmed) {
2026-10-03 08:58:59 +00:00
let closure_0 = trimmed;
let value;
2026-07-29 08:29:29 +00:00
if (choices != null) {
2026-08-24 06:08:38 +00:00
const iter = choices.find((displayName) => displayName.displayName === closure_0);
2026-07-29 08:29:29 +00:00
if (iter != null) {
2026-07-20 16:05:17 +00:00
value = iter.value;
}
}
2026-08-04 21:03:28 +00:00
return typeof value === "number" ? value : undefined;
2026-07-20 16:05:17 +00:00
};
export const findAutocompleteChoiceStringValue = function findAutocompleteChoiceStringValue(id, name, surrogate) {
const autocompleteLastChoices = ApplicationCommandAutocompleteStore.getAutocompleteLastChoices(id, name);
2026-10-03 08:58:59 +00:00
let closure_0 = surrogate;
let value;
2026-07-29 08:29:29 +00:00
if (autocompleteLastChoices != null) {
2026-08-24 06:08:38 +00:00
const iter = autocompleteLastChoices.find((displayName) => displayName.displayName === closure_0);
2026-07-29 08:29:29 +00:00
if (iter != null) {
value = iter.value;
}
}
let tmp2;
2026-08-04 21:03:28 +00:00
if (typeof value === "string") {
2026-07-29 08:29:29 +00:00
tmp2 = value;
}
return tmp2;
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const findAutocompleteChoiceNumberValue = function findAutocompleteChoiceNumberValue(id, name, trimmed) {
const autocompleteLastChoices = ApplicationCommandAutocompleteStore.getAutocompleteLastChoices(id, name);
2026-10-03 08:58:59 +00:00
let closure_0 = trimmed;
let value;
2026-07-29 08:29:29 +00:00
if (autocompleteLastChoices != null) {
2026-08-24 06:08:38 +00:00
const iter = autocompleteLastChoices.find((displayName) => displayName.displayName === closure_0);
2026-07-29 08:29:29 +00:00
if (iter != null) {
value = iter.value;
}
}
let tmp2;
2026-08-04 21:03:28 +00:00
if (typeof value === "number") {
2026-07-29 08:29:29 +00:00
tmp2 = value;
}
return tmp2;
2026-07-20 16:05:17 +00:00
};