205 lines
11 KiB
TypeScript
205 lines
11 KiB
TypeScript
/* Metro module 7166; source: modules/application_commands/ApplicationCommandActionCreators.tsx; dependencies: [1226, 7167, 661, 44, 5068, 694, 507, 21, 1909, 2] */
|
|
function _fun57508(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:6, offset: 0x013e757b, size: 293 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = updateOptionStates;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
|
|
const applicationCommandAutocompleteStore = importDefault(7167) /* metro dependency 7167: ApplicationCommandAutocompleteStore */;
|
|
const env0_5 = (require(661) /* metro dependency 661: Constants */).Endpoints;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/application_commands/ApplicationCommandActionCreators.tsx');
|
|
exports.setActiveCommand = setActiveCommand;
|
|
exports.setPreferredCommandId = setPreferredCommandId;
|
|
exports.updateOptionStates = closure;
|
|
exports.updateOptionValidationStates = updateOptionValidationStates;
|
|
exports.updateChannelState = updateChannelState;
|
|
exports.updateApplicationGuildCommandPermissions = function(a0, a1, a2, a3) {
|
|
var HTTP = require(dependencyMap[6]).HTTP;
|
|
var object = {};
|
|
object.body = {permissions: a3};
|
|
object.url = Endpoints.APPLICATION_BOT_GUILD_COMMAND_PERMISSIONS(a0, a1, a2);
|
|
object.rejectWithError = false;
|
|
return HTTP.put(object);
|
|
};
|
|
exports.performAutocomplete = performAutocomplete;
|
|
exports.fetchCommand = fetchCommand;
|
|
exports.fetchCommands = fetchCommands;
|
|
exports.fetchCommandsForApplication = fetchCommandsForApplication;
|
|
exports.updateRegistry = updateRegistry;
|
|
exports.setAppLauncherActiveCommand = setAppLauncherActiveCommand;
|
|
}
|
|
|
|
function updateOptionStates(a0, a1) { // fn#57509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:136, offset: 0x013e76a0, size: 64 bytes, params: 3, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APPLICATION_COMMAND_UPDATE_OPTIONS',
|
|
channelId: a0, changedOptionStates: a1});
|
|
}
|
|
|
|
function setActiveCommand({channelId, command, section, location, initialValues, triggerSection, queryLength, sectionName, query, searchResultsPosition, source, commandOrigin}) { // fn#57510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:383, offset: 0x013e76e0, size: 257 bytes, params: 2, frame: 27
|
|
if (command != null) {
|
|
(importDefault(44) /* metro dependency 44 */)(command.inputType !== (require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandInputType.PLACEHOLDER,
|
|
|
|
'command should not be placeholder');
|
|
}
|
|
const dispatcher = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
dispatcher.dispatch({type: 'APPLICATION_COMMAND_SET_ACTIVE_COMMAND', channelId: channelId, command: command,
|
|
section: section, initialValues: initialValues, location: location, triggerSection: triggerSection,
|
|
queryLength: queryLength, sectionName: sectionName, query: query, searchResultsPosition: searchResultsPosition,
|
|
source: source, commandOrigin: commandOrigin});
|
|
}
|
|
|
|
function setPreferredCommandId(a0, a1) { // fn#57511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:941, offset: 0x013e77e1, size: 64 bytes, params: 3, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APPLICATION_COMMAND_SET_PREFERRED_COMMAND',
|
|
channelId: a0, commandId: a1});
|
|
}
|
|
|
|
function updateOptionValidationStates(a0, a1) { // fn#57512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:1142, offset: 0x013e7821, size: 76 bytes, params: 3, frame: 15
|
|
var value;
|
|
const updateOptionStatesBinding = updateOptionStates;
|
|
const Object = global.Object;
|
|
const fromEntries = Object.fromEntries;
|
|
const Object2 = global.Object;
|
|
value = Reflect.apply(fromEntries, Object, [Reflect.apply(Object2.entries(a1).map, value, [function(a0) {
|
|
var r0;
|
|
var r2;
|
|
var r3;
|
|
var item3;
|
|
var value3;
|
|
var iterator = a0[Symbol.iterator]();
|
|
var iterator2 = iterator.next;
|
|
var item2 = Reflect.apply(iterator2, iterator, []);
|
|
var item = item2.value;
|
|
item2 = item2.done ? undefined : iterator;
|
|
var value = undefined;
|
|
var value2 = item2 === value;
|
|
var r1 = value2 ? value : item;
|
|
if (value2) {
|
|
r0 = item2;
|
|
r2 = value;
|
|
r3 = value2;
|
|
} else {
|
|
item3 = Reflect.apply(iterator2, item2, []);
|
|
item = item3.value;
|
|
item3 = item3.done ? undefined : item2;
|
|
value3 = item3 === value;
|
|
if (value3) {
|
|
r0 = item3;
|
|
r2 = value;
|
|
r3 = value3;
|
|
} else {
|
|
r0 = item3;
|
|
r2 = item;
|
|
r3 = value3;
|
|
}
|
|
}
|
|
if (!r3) {
|
|
r0.return();
|
|
}
|
|
return [r1, {lastValidationResult: r2}];
|
|
}])]);
|
|
updateOptionStatesBinding(a0, value);
|
|
}
|
|
|
|
function updateChannelState({channelId, command, section, preferredCommandId, location, changedOptionStates}) { // fn#57514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:1312, offset: 0x013e78c1, size: 112 bytes, params: 2, frame: 19
|
|
const dispatcher = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
dispatcher.dispatch({type: 'APPLICATION_COMMAND_UPDATE_CHANNEL_STATE', channelId: channelId, command: command,
|
|
section: section, preferredCommandId: preferredCommandId, location: location,
|
|
changedOptionStates: changedOptionStates});
|
|
}
|
|
|
|
function performAutocomplete(a0, a1, a2) { // fn#57516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:1831, offset: 0x013e7990, size: 433 bytes, params: 4, frame: 23
|
|
var id;
|
|
var defaultImport3;
|
|
var dispatch;
|
|
var object3;
|
|
var getAutocompleteChoices;
|
|
var HTTP;
|
|
var post;
|
|
var object4;
|
|
var guild;
|
|
const value2 = undefined;
|
|
const defaultImport = importDefault(44) /* metro dependency 44 */;
|
|
let autocomplete = a1.autocomplete;
|
|
defaultImport(autocomplete != null, 'Missing autocomplete context');
|
|
autocomplete = a1.autocomplete;
|
|
const query = autocomplete.query;
|
|
const name = autocomplete.name;
|
|
const defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
const fromTimestamp = defaultImport2.fromTimestamp;
|
|
const Date = global.Date;
|
|
const value3 = Reflect.apply(fromTimestamp, defaultImport2, [Date.now()]);
|
|
let channel = a1.channel;
|
|
if (channel != null) {
|
|
defaultImport3 = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
dispatch = defaultImport3.dispatch;
|
|
object3 = {type: 'APPLICATION_COMMAND_AUTOCOMPLETE_REQUEST', nonce: value3};
|
|
channel = a1.channel;
|
|
id = channel.id;
|
|
object3.channelId = id;
|
|
object3.query = query;
|
|
object3.name = name;
|
|
Reflect.apply(dispatch, defaultImport3, [object3]);
|
|
getAutocompleteChoices = ApplicationCommandAutocompleteStore.getAutocompleteChoices;
|
|
channel = a1.channel;
|
|
id = channel.id;
|
|
if (Reflect.apply(getAutocompleteChoices, ApplicationCommandAutocompleteStore, [id, name, query]) == null) {
|
|
HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
post = HTTP.post;
|
|
object3 = {};
|
|
object3.url = Endpoints.INTERACTIONS;
|
|
object4 = {};
|
|
object4.type = (require(1909) /* metro dependency 1909: Server */).InteractionTypes.APPLICATION_COMMAND_AUTOCOMPLETE;
|
|
object4.application_id = a0.applicationId;
|
|
guild = a1.guild;
|
|
id = guild == null ? value2 : guild.id;
|
|
object4.guild_id = id;
|
|
id = a1.channel.id;
|
|
object4.channel_id = id;
|
|
object4.session_id = AuthenticationStore.getSessionId();
|
|
object4.data = a2;
|
|
object4.nonce = value3;
|
|
object3.body = object4;
|
|
object3.timeout = 3000;
|
|
object3.rejectWithError = true;
|
|
Reflect.apply(post, HTTP, [object3]).catch(_fun57517);
|
|
}
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function fetchCommand(a0, a1, a2) { // fn#57518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:2557, offset: 0x013e7b7c, size: 71 bytes, params: 4, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APPLICATION_COMMAND_FETCH',
|
|
channelId: a1, commandId: a2, guildId: a0});
|
|
}
|
|
|
|
function fetchCommands(a0, a1, a2) { // fn#57519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:2690, offset: 0x013e7bc3, size: 71 bytes, params: 4, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APPLICATION_COMMANDS_FETCH',
|
|
channelId: a1, commandIds: a2, guildId: a0});
|
|
}
|
|
|
|
function fetchCommandsForApplication({guildId, channelId, applicationId}) { // fn#57520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:2840, offset: 0x013e7c0a, size: 79 bytes, params: 2, frame: 16
|
|
const dispatcher = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
dispatcher.dispatch({type: 'APPLICATION_COMMANDS_FETCH_FOR_APPLICATION', channelId: channelId, guildId: guildId,
|
|
applicationId: applicationId});
|
|
}
|
|
|
|
function updateRegistry(a0, a1, a2) { // fn#57521, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:3044, offset: 0x013e7c59, size: 72 bytes, params: 4, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APPLICATION_COMMAND_REGISTRY_UPDATE',
|
|
applications: a1, commands: a0, channelId: a2});
|
|
}
|
|
|
|
function setAppLauncherActiveCommand(a0, a1) { // fn#57522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:3207, offset: 0x013e7ca1, size: 143 bytes, params: 3, frame: 16
|
|
if (a1 != null) {
|
|
(importDefault(44) /* metro dependency 44 */)(a1.inputType !== (require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandInputType.PLACEHOLDER,
|
|
|
|
'command should not be placeholder');
|
|
}
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'APP_LAUNCHER_SET_ACTIVE_COMMAND',
|
|
channelId: a0, command: a1});
|
|
}
|
|
|
|
function _fun57517() { // fn#57517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7344:2477, offset: 0x013e7b41, size: 59 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'INTERACTION_FAILURE', nonce: env0_0});
|
|
}
|
|
|