634 lines
22 KiB
JavaScript
634 lines
22 KiB
JavaScript
// Module ID: 6742
|
|
// Function ID: 52456
|
|
// Name: _createForOfIteratorHelperLoose
|
|
// Dependencies: []
|
|
// Exports: allChannelsSentinel, applicationPermissionsList, buildApplicationCommands, canUseApplicationCommands, extractInteractionDataProps, getApplicationCommandOptionQueryOptions, getApplicationCommandSection, getCommandAttachmentDraftType, getCommandTriggerSection, getInitialInteractionMetadata, getMatchingGroupCommands, hasAccess, hasCommandIndexForApp, isSnowflake, trackCommandSelected
|
|
|
|
// Module 6742 (_createForOfIteratorHelperLoose)
|
|
import deserializeResult from "module_0";
|
|
|
|
function _createForOfIteratorHelperLoose(@@iterator) {
|
|
let require = Symbol_iterator;
|
|
@@iterator = "undefined" !== typeof Symbol;
|
|
if (Symbol_iterator) {
|
|
const _Symbol = Symbol;
|
|
@@iterator = Symbol_iterator[Symbol.iterator];
|
|
}
|
|
if (!Symbol_iterator) {
|
|
@@iterator = Symbol_iterator[Symbol.iterator];
|
|
}
|
|
if (Symbol_iterator) {
|
|
const iter = Symbol_iterator.call(Symbol_iterator);
|
|
const next = iter.next;
|
|
return next.bind(iter);
|
|
} else {
|
|
const _Array = Array;
|
|
let tmp = Symbol_iterator;
|
|
if (!Array.isArray(Symbol_iterator)) {
|
|
let tmp2;
|
|
if (Symbol_iterator) {
|
|
if ("string" === typeof Symbol_iterator) {
|
|
tmp2 = _arrayLikeToArray(Symbol_iterator, undefined);
|
|
} else {
|
|
const toString = {}.toString;
|
|
const substr = toString.call(Symbol_iterator).slice(8, -1);
|
|
let name = substr;
|
|
if (tmp3) {
|
|
name = Symbol_iterator.constructor.name;
|
|
}
|
|
if ("Map" !== name) {
|
|
if ("Set" !== name) {
|
|
if ("Arguments" === name) {
|
|
let arr = _arrayLikeToArray(Symbol_iterator, undefined);
|
|
} else {
|
|
const obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/;
|
|
}
|
|
}
|
|
tmp2 = arr;
|
|
}
|
|
const _Array2 = Array;
|
|
arr = Array.from(Symbol_iterator);
|
|
const callResult = toString.call(Symbol_iterator);
|
|
const tmp3 = "Object" === substr && Symbol_iterator.constructor;
|
|
}
|
|
}
|
|
tmp = tmp2;
|
|
if (!tmp2) {
|
|
const _TypeError = TypeError;
|
|
const typeError = new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
throw typeError;
|
|
}
|
|
}
|
|
if (tmp) {
|
|
require = tmp;
|
|
}
|
|
let closure_1 = 0;
|
|
return () => {
|
|
if (closure_1 >= tmp.length) {
|
|
let obj = { done: true };
|
|
} else {
|
|
obj = { done: false };
|
|
closure_1 = tmp3 + 1;
|
|
obj.value = tmp[+closure_1];
|
|
}
|
|
return obj;
|
|
};
|
|
}
|
|
}
|
|
function _arrayLikeToArray(arg0, arg1) {
|
|
let length;
|
|
if (tmp) {
|
|
length = arg0.length;
|
|
}
|
|
const ArrayResult = Array(length);
|
|
for (let num = 0; num < length; num = num + 1) {
|
|
ArrayResult[num] = arg0[num];
|
|
}
|
|
return ArrayResult;
|
|
}
|
|
function buildCommand(arg0) {
|
|
let applicationId;
|
|
let command;
|
|
let rootCommand;
|
|
let subCommandPath;
|
|
let useKeyedPermissions;
|
|
({ rootCommand, command, subCommandPath } = arg0);
|
|
let require;
|
|
let tmp = null != rootCommand.permissions;
|
|
({ applicationId, useKeyedPermissions } = arg0);
|
|
if (tmp) {
|
|
tmp = rootCommand.permissions.length > 0;
|
|
}
|
|
if (!tmp) {
|
|
let items = subCommandPath;
|
|
if (null == subCommandPath) {
|
|
items = [];
|
|
}
|
|
const mapped = items.map((name) => name.name);
|
|
let items1 = subCommandPath;
|
|
if (null == subCommandPath) {
|
|
items1 = [];
|
|
}
|
|
const mapped1 = items1.map((displayName) => displayName.displayName);
|
|
let obj = {};
|
|
({ version: obj3.version, guild_id: obj3.guildId } = rootCommand);
|
|
const items2 = [rootCommand.id];
|
|
HermesBuiltin.arraySpread(mapped, 1);
|
|
obj.id = items2.join(closure_7);
|
|
const items3 = [rootCommand.name];
|
|
HermesBuiltin.arraySpread(mapped, 1);
|
|
obj.untranslatedName = items3.join(" ");
|
|
obj.serverLocalizedName = command.name_localized;
|
|
obj.applicationId = applicationId;
|
|
let CHAT = rootCommand.type;
|
|
if (null == CHAT) {
|
|
CHAT = require(dependencyMap[6]).ApplicationCommandType.CHAT;
|
|
}
|
|
obj.type = CHAT;
|
|
obj.inputType = require(dependencyMap[7]).ApplicationCommandInputType.BOT;
|
|
obj.untranslatedDescription = command.description;
|
|
obj.options = mapOptions(command.options);
|
|
obj.rootCommand = rootCommand;
|
|
obj.subCommandPath = subCommandPath;
|
|
let deserializeResult;
|
|
if (null != rootCommand.default_member_permissions) {
|
|
deserializeResult = importAll(dependencyMap[8]).deserialize(rootCommand.default_member_permissions);
|
|
const obj4 = importAll(dependencyMap[8]);
|
|
}
|
|
obj.defaultMemberPermissions = deserializeResult;
|
|
obj.dmPermission = rootCommand.dm_permission;
|
|
obj.permissions = undefined;
|
|
let name = rootCommand.name_localized;
|
|
if (null == name) {
|
|
name = rootCommand.name;
|
|
}
|
|
const items4 = [name];
|
|
HermesBuiltin.arraySpread(mapped1, 1);
|
|
obj.displayName = items4.join(" ");
|
|
let description = command.description_localized;
|
|
if (null == description) {
|
|
description = command.description;
|
|
}
|
|
obj.displayDescription = description;
|
|
({ nsfw: obj3.nsfw, contexts: obj3.contexts, integration_types: obj3.integration_types, global_popularity_rank: obj3.global_popularity_rank, handler: obj3.handler } = rootCommand);
|
|
return obj;
|
|
} else if (useKeyedPermissions) {
|
|
const keyPermissionsResult = require(dependencyMap[5]).keyPermissions(rootCommand.permissions);
|
|
require = keyPermissionsResult;
|
|
obj = keyPermissionsResult;
|
|
const obj2 = require(dependencyMap[5]);
|
|
} else {
|
|
obj = {};
|
|
require = obj;
|
|
const permissions = rootCommand.permissions;
|
|
const item = permissions.forEach((id) => {
|
|
obj[id.id] = id;
|
|
});
|
|
}
|
|
}
|
|
function mapOptions(options) {
|
|
let mapped;
|
|
if (null != options) {
|
|
mapped = options.map((choices) => {
|
|
let name_localized;
|
|
let obj = {};
|
|
const merged = Object.assign(choices);
|
|
choices = choices.choices;
|
|
let mapped;
|
|
if (null != choices) {
|
|
mapped = choices.map((name_localized) => {
|
|
const obj = {};
|
|
const merged = Object.assign(name_localized);
|
|
let name = name_localized.name_localized;
|
|
if (null == name) {
|
|
name = name_localized.name;
|
|
}
|
|
obj["displayName"] = name;
|
|
return obj;
|
|
});
|
|
}
|
|
obj["choices"] = mapped;
|
|
obj["options"] = callback2(choices.options);
|
|
({ name_localized: obj["serverLocalizedName"], name_localized } = choices);
|
|
if (null == name_localized) {
|
|
name_localized = choices.name;
|
|
}
|
|
obj["displayName"] = name_localized;
|
|
let description = choices.description_localized;
|
|
if (null == description) {
|
|
description = choices.description;
|
|
}
|
|
obj["displayDescription"] = description;
|
|
if (choices.type === callback(closure_3[6]).ApplicationCommandOptionType.CHANNEL) {
|
|
if ("channel_types" in choices) {
|
|
obj = {};
|
|
const merged1 = Object.assign(obj);
|
|
obj["channelTypes"] = choices.channel_types;
|
|
}
|
|
return obj;
|
|
}
|
|
if (choices.type === callback(closure_3[6]).ApplicationCommandOptionType.NUMBER) {
|
|
obj = {};
|
|
const merged2 = Object.assign(obj);
|
|
obj["minValue"] = choices.min_value;
|
|
obj["maxValue"] = choices.max_value;
|
|
}
|
|
if (choices.type !== callback(closure_3[6]).ApplicationCommandOptionType.STRING) {
|
|
let tmp10 = obj;
|
|
if (choices.type === callback(closure_3[6]).ApplicationCommandOptionType.ATTACHMENT) {
|
|
tmp10 = obj;
|
|
if ("file_types" in choices) {
|
|
const obj1 = {};
|
|
const merged3 = Object.assign(obj);
|
|
obj1["fileTypes"] = choices.file_types;
|
|
tmp10 = obj1;
|
|
}
|
|
}
|
|
}
|
|
const obj2 = {};
|
|
const merged4 = Object.assign(obj);
|
|
obj2["minLength"] = choices.min_length;
|
|
obj2["maxLength"] = choices.max_length;
|
|
tmp10 = obj2;
|
|
});
|
|
}
|
|
return mapped;
|
|
}
|
|
function buildSubCommands(arg0) {
|
|
let applicationId;
|
|
let command;
|
|
let rootCommand;
|
|
let subCommandPath;
|
|
let useKeyedPermissions;
|
|
({ rootCommand, command, applicationId, subCommandPath, useKeyedPermissions } = arg0);
|
|
if (command.hasOwnProperty("id")) {
|
|
let obj = { rootCommand, command, applicationId, subCommandPath, useKeyedPermissions };
|
|
const items = [buildCommand(obj)];
|
|
return items;
|
|
} else if (command.type !== require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND) {
|
|
if (command.type !== require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND_GROUP) {
|
|
obj = { rootCommand, command, applicationId, subCommandPath, useKeyedPermissions };
|
|
const items1 = [buildCommand(obj)];
|
|
return items1;
|
|
}
|
|
}
|
|
const items2 = [];
|
|
if (null == command.options) {
|
|
return items2;
|
|
} else {
|
|
const options = command.options;
|
|
const found = options.filter((type) => type.type === callback(closure_3[6]).ApplicationCommandOptionType.SUB_COMMAND_GROUP);
|
|
for (let num4 = 0; num4 < found.length; num4 = num4 + 1) {
|
|
let push = items2.push;
|
|
obj = { rootCommand, command: found[num4], applicationId };
|
|
let items3 = subCommandPath;
|
|
let tmp6 = buildSubCommands;
|
|
if (null == subCommandPath) {
|
|
items3 = [];
|
|
}
|
|
let obj1 = { name: found[num4].name };
|
|
let tmp7 = require;
|
|
let tmp8 = dependencyMap;
|
|
obj1.type = require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND_GROUP;
|
|
let name = found[num4].name_localized;
|
|
if (null == name) {
|
|
name = found[num4].name;
|
|
}
|
|
obj1.displayName = name;
|
|
let items4 = [obj1];
|
|
obj.subCommandPath = items3.concat(items4);
|
|
obj.useKeyedPermissions = useKeyedPermissions;
|
|
let items5 = [];
|
|
let tmp9 = items5;
|
|
let num3 = 0;
|
|
let arraySpreadResult = HermesBuiltin.arraySpread(tmp6(obj), 0);
|
|
let tmp11 = push;
|
|
let tmp12 = items5;
|
|
let tmp13 = items2;
|
|
let applyResult = HermesBuiltin.apply(items5, items2);
|
|
}
|
|
const options1 = command.options;
|
|
const found1 = options1.filter((type) => type.type === callback(closure_3[6]).ApplicationCommandOptionType.SUB_COMMAND);
|
|
for (let num5 = 0; num5 < found1.length; num5 = num5 + 1) {
|
|
let obj2 = { rootCommand, command: found1[num5], applicationId };
|
|
let items6 = subCommandPath;
|
|
let tmp15 = buildCommand;
|
|
if (null == subCommandPath) {
|
|
items6 = [];
|
|
}
|
|
let obj3 = { name: found1[num5].name };
|
|
let tmp16 = require;
|
|
let tmp17 = dependencyMap;
|
|
obj3.type = require(dependencyMap[6]).ApplicationCommandOptionType.SUB_COMMAND;
|
|
let name2 = found1[num5].name_localized;
|
|
if (null == name2) {
|
|
name2 = found1[num5].name;
|
|
}
|
|
obj3.displayName = name2;
|
|
let items7 = [obj3];
|
|
obj2.subCommandPath = items6.concat(items7);
|
|
obj2.useKeyedPermissions = useKeyedPermissions;
|
|
let arr = items2.push(tmp15(obj2));
|
|
}
|
|
if (tmp19) {
|
|
const obj4 = { rootCommand, command, applicationId, subCommandPath, useKeyedPermissions };
|
|
items2.push(buildCommand(obj4));
|
|
}
|
|
return items2;
|
|
}
|
|
}
|
|
function hasAccessGivenPerms(selfMember, id, commandLevelPermissions) {
|
|
const obj = require(dependencyMap[5]);
|
|
if (null != commandLevelPermissions[obj.toPermissionKey(obj, selfMember.userId, closure_0(undefined, closure_3[7]).ApplicationCommandPermissionType.USER)]) {
|
|
return tmp.permission;
|
|
} else {
|
|
const tmp11 = _createForOfIteratorHelperLoose(selfMember.roles);
|
|
const iter3 = tmp11();
|
|
let iter2 = iter3;
|
|
let flag = false;
|
|
let flag2 = false;
|
|
if (!iter3.done) {
|
|
while (true) {
|
|
let tmp2 = require;
|
|
let tmp3 = dependencyMap;
|
|
let obj2 = require(dependencyMap[5]);
|
|
let tmp4 = commandLevelPermissions[obj2.toPermissionKey(obj2, iter2.value, closure_0(undefined, closure_3[7]).ApplicationCommandPermissionType.ROLE)];
|
|
if (null != tmp4) {
|
|
flag = true;
|
|
if (tmp4.permission) {
|
|
break;
|
|
}
|
|
}
|
|
let iter = tmp11();
|
|
iter2 = iter;
|
|
flag2 = flag;
|
|
}
|
|
return true;
|
|
}
|
|
if (flag2) {
|
|
return false;
|
|
} else {
|
|
const obj3 = require(dependencyMap[5]);
|
|
let permission = null;
|
|
if (null != commandLevelPermissions[obj3.toPermissionKey(obj3, id, closure_0(undefined, closure_3[7]).ApplicationCommandPermissionType.ROLE)]) {
|
|
permission = tmp8.permission;
|
|
}
|
|
return permission;
|
|
}
|
|
}
|
|
}
|
|
const isReadableType = require(dependencyMap[0]).isReadableType;
|
|
const DraftType = require(dependencyMap[1]).DraftType;
|
|
const _module = require(dependencyMap[2]);
|
|
({ BuiltInSectionId: closure_6, SUB_COMMAND_KEY_SEPARATOR: closure_7 } = _module);
|
|
const _module1 = require(dependencyMap[3]);
|
|
({ AnalyticEvents: closure_8, ID_REGEX: closure_9 } = _module1);
|
|
const Permissions = require(dependencyMap[4]).Permissions;
|
|
const _module2 = require(dependencyMap[13]);
|
|
const result = _module2.fileFinishedImporting("modules/application_commands/ApplicationCommandUtils.tsx");
|
|
|
|
export { buildCommand };
|
|
export const buildApplicationCommands = function buildApplicationCommands(application_commands, arg1) {
|
|
const require = arg1;
|
|
return importDefault(dependencyMap[9]).flatMap(application_commands, (id) => {
|
|
callback(closure_3[10])(null != id.id, "Missing command id");
|
|
return callback2({ rootCommand: id, command: id, applicationId: id.application_id, subCommandPath: undefined, useKeyedPermissions: arg1 });
|
|
});
|
|
};
|
|
export const applicationPermissionsList = function applicationPermissionsList(arr) {
|
|
let reduced;
|
|
if (null != arr) {
|
|
reduced = arr.reduce((arr, applicationCommandPermissions) => {
|
|
if (null != applicationCommandPermissions.applicationCommandPermissions) {
|
|
const obj = {};
|
|
({ id: obj.id, applicationCommandPermissions: obj.permissions } = applicationCommandPermissions);
|
|
arr.push(obj);
|
|
}
|
|
return arr;
|
|
}, []);
|
|
}
|
|
return reduced;
|
|
};
|
|
export const isSnowflake = function isSnowflake(text) {
|
|
return regex.test(text.trim());
|
|
};
|
|
export const getMatchingGroupCommands = function getMatchingGroupCommands(contextCommands, regExp, closure_3, arg3) {
|
|
const require = regExp;
|
|
const importDefault = closure_3;
|
|
const items = [];
|
|
const importAll = items;
|
|
const item = importDefault(dependencyMap[9])(contextCommands).forEach((displayName) => {
|
|
let isMatch = arg1.test(displayName.displayName);
|
|
if (isMatch) {
|
|
let predicateResult = null == displayName.predicate;
|
|
if (!predicateResult) {
|
|
predicateResult = displayName.predicate(arg2);
|
|
}
|
|
isMatch = predicateResult;
|
|
}
|
|
if (isMatch) {
|
|
items.push(displayName);
|
|
}
|
|
});
|
|
return items.slice(0, arg3);
|
|
};
|
|
export const getApplicationCommandOptionQueryOptions = function getApplicationCommandOptionQueryOptions(activeOption) {
|
|
const tmp = activeOption.type === require(dependencyMap[6]).ApplicationCommandOptionType.STRING;
|
|
let tmp3 = activeOption.type === require(dependencyMap[6]).ApplicationCommandOptionType.USER;
|
|
if (!tmp3) {
|
|
tmp3 = activeOption.type === require(dependencyMap[6]).ApplicationCommandOptionType.MENTIONABLE;
|
|
}
|
|
let tmp6 = activeOption.type === require(dependencyMap[6]).ApplicationCommandOptionType.ROLE;
|
|
if (!tmp6) {
|
|
tmp6 = activeOption.type === require(dependencyMap[6]).ApplicationCommandOptionType.MENTIONABLE;
|
|
}
|
|
const obj = {};
|
|
let tmp9 = tmp;
|
|
if (!tmp) {
|
|
tmp9 = tmp6;
|
|
}
|
|
obj.canMentionEveryone = tmp9;
|
|
obj.canMentionHere = tmp;
|
|
let tmp10 = tmp;
|
|
if (!tmp) {
|
|
tmp10 = tmp2;
|
|
}
|
|
obj.canMentionChannels = tmp10;
|
|
let tmp11 = tmp;
|
|
if (!tmp) {
|
|
tmp11 = tmp3;
|
|
}
|
|
obj.canMentionUsers = tmp11;
|
|
let tmp12 = tmp;
|
|
if (!tmp) {
|
|
tmp12 = tmp6;
|
|
}
|
|
obj.canMentionRoles = tmp12;
|
|
obj.canMentionAnyGuildUser = tmp3;
|
|
obj.canMentionNonMentionableRoles = tmp6;
|
|
obj.canMentionOtherGlobals = tmp;
|
|
return obj;
|
|
};
|
|
export const allChannelsSentinel = function allChannelsSentinel(guild_id) {
|
|
const obj = importDefault(dependencyMap[11])(guild_id);
|
|
return importDefault(dependencyMap[11])(guild_id).subtract(1).toString();
|
|
};
|
|
export const canUseApplicationCommands = function canUseApplicationCommands(can, arg1, isMultiUserDM) {
|
|
let tmp = !arg1;
|
|
if (tmp) {
|
|
const tmp2 = !isMultiUserDM.isMultiUserDM();
|
|
if (!tmp2) {
|
|
tmp = !tmp2;
|
|
} else if (isMultiUserDM.isDM()) {
|
|
let canResult = !isMultiUserDM.isSystemDM();
|
|
} else if (isMultiUserDM.isArchivedLockedThread()) {
|
|
canResult = can.can(importAll(dependencyMap[8]).combine(Permissions.USE_APPLICATION_COMMANDS, Permissions.MANAGE_THREADS), isMultiUserDM);
|
|
const obj2 = importAll(dependencyMap[8]);
|
|
} else {
|
|
const tmp4 = !isReadableType(isMultiUserDM.type);
|
|
canResult = !tmp4;
|
|
if (!tmp4) {
|
|
canResult = can.can(importAll(dependencyMap[8]).combine(Permissions.USE_APPLICATION_COMMANDS, Permissions.SEND_MESSAGES), isMultiUserDM);
|
|
const obj = importAll(dependencyMap[8]);
|
|
}
|
|
}
|
|
}
|
|
return tmp;
|
|
};
|
|
export const DISABLED_BY_DEFAULT_PERMISSION_FLAG = deserializeResult;
|
|
export const hasAccess = function hasAccess(arg0) {
|
|
let PermissionStore;
|
|
let commandLevelPermissions;
|
|
let defaultMemberPermissions;
|
|
let guild;
|
|
let selfMember;
|
|
({ PermissionStore, guild, selfMember, commandLevelPermissions, defaultMemberPermissions } = arg0);
|
|
if (guild.ownerId !== selfMember.userId) {
|
|
if (!PermissionStore.can(Permissions.ADMINISTRATOR, guild)) {
|
|
const id = guild.id;
|
|
if (null != commandLevelPermissions) {
|
|
const tmp4 = hasAccessGivenPerms(selfMember, id, commandLevelPermissions);
|
|
if ("boolean" === typeof tmp4) {
|
|
return tmp4;
|
|
}
|
|
}
|
|
const tmp6 = hasAccessGivenPerms(selfMember, id, tmp);
|
|
let tmp8 = !tmp7;
|
|
if (!("boolean" === typeof tmp6 && !tmp6)) {
|
|
let tmp9 = null == defaultMemberPermissions;
|
|
if (!tmp9) {
|
|
const obj = importAll(dependencyMap[8]);
|
|
tmp9 = !importAll(dependencyMap[8]).equals(defaultMemberPermissions, deserializeResult) && PermissionStore.can(defaultMemberPermissions, guild);
|
|
const tmp13 = !importAll(dependencyMap[8]).equals(defaultMemberPermissions, deserializeResult) && PermissionStore.can(defaultMemberPermissions, guild);
|
|
}
|
|
tmp8 = tmp9;
|
|
}
|
|
return tmp8;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
export const getCommandAttachmentDraftType = function getCommandAttachmentDraftType(commandOrigin) {
|
|
if (require(dependencyMap[7]).CommandOrigin.CHAT === commandOrigin) {
|
|
return DraftType.SlashCommand;
|
|
} else {
|
|
return DraftType.ApplicationLauncherCommand;
|
|
}
|
|
};
|
|
export const getCommandTriggerSection = function getCommandTriggerSection(closure_3) {
|
|
if (null != closure_3) {
|
|
if (closure_3.id === constants.BUILT_IN) {
|
|
let APP = require(dependencyMap[7]).ApplicationCommandTriggerSections.BUILT_IN;
|
|
} else if (closure_3.id === constants.FRECENCY) {
|
|
APP = require(dependencyMap[7]).ApplicationCommandTriggerSections.FRECENCY;
|
|
} else {
|
|
APP = require(dependencyMap[7]).ApplicationCommandTriggerSections.APP;
|
|
}
|
|
return APP;
|
|
}
|
|
};
|
|
export const getApplicationCommandSection = function getApplicationCommandSection(application, arg1, arg2) {
|
|
let name = arg2;
|
|
const obj = { type: require(dependencyMap[7]).ApplicationCommandSectionType.APPLICATION, id: application.id };
|
|
if (null == arg2) {
|
|
let username;
|
|
if (null != application) {
|
|
const bot = application.bot;
|
|
if (null != bot) {
|
|
username = bot.username;
|
|
}
|
|
}
|
|
name = username;
|
|
}
|
|
if (null == name) {
|
|
name = application.name;
|
|
}
|
|
obj.name = name;
|
|
obj.icon = application.icon;
|
|
obj.application = application;
|
|
obj.isUserApp = null != arg1 && arg1;
|
|
return obj;
|
|
};
|
|
export const extractInteractionDataProps = function extractInteractionDataProps(parsed) {
|
|
let id;
|
|
let options;
|
|
({ id, options } = parsed);
|
|
let found;
|
|
if (null != options) {
|
|
found = options.find((type) => type.type === callback(closure_3[6]).ApplicationCommandOptionType.SUB_COMMAND_GROUP);
|
|
}
|
|
let sum = id;
|
|
if (null != found) {
|
|
const _HermesInternal = HermesInternal;
|
|
sum = id + "" + closure_7 + found.name;
|
|
options = found.options;
|
|
}
|
|
let found1;
|
|
if (null != options) {
|
|
found1 = options.find((type) => type.type === callback(closure_3[6]).ApplicationCommandOptionType.SUB_COMMAND);
|
|
}
|
|
let sum1 = sum;
|
|
if (null != found1) {
|
|
const _HermesInternal2 = HermesInternal;
|
|
sum1 = sum + "" + closure_7 + found1.name;
|
|
options = found1.options;
|
|
}
|
|
const obj = { commandKey: sum1, interactionOptions: options };
|
|
return obj;
|
|
};
|
|
export const trackCommandSelected = function trackCommandSelected(command) {
|
|
let _location;
|
|
let query;
|
|
let queryLength;
|
|
let searchResultsPosition;
|
|
let sectionName;
|
|
let source;
|
|
let triggerSection;
|
|
command = command.command;
|
|
({ location: _location, triggerSection, queryLength, sectionName, query, searchResultsPosition, source } = command);
|
|
let obj = require(dependencyMap[12]);
|
|
obj = {};
|
|
const rootCommand = command.rootCommand;
|
|
let id;
|
|
if (null != rootCommand) {
|
|
id = rootCommand.id;
|
|
}
|
|
if (null == id) {
|
|
id = command.id;
|
|
}
|
|
obj.command_id = id;
|
|
obj.application_id = command.applicationId;
|
|
obj.location = _location;
|
|
obj.section = triggerSection;
|
|
obj.query_length = queryLength;
|
|
obj.command_text_length = command.displayName.length;
|
|
obj.section_name = sectionName;
|
|
obj.query = query;
|
|
obj.search_results_position = searchResultsPosition;
|
|
obj.source = source;
|
|
obj.trackWithMetadata(constants2.APPLICATION_COMMAND_SELECTED, obj);
|
|
};
|
|
export const getInitialInteractionMetadata = function getInitialInteractionMetadata(interactionMetadata) {
|
|
interactionMetadata = interactionMetadata.interactionMetadata;
|
|
let tmp = null;
|
|
if (null != interactionMetadata) {
|
|
let triggering_interaction_metadata = interactionMetadata;
|
|
if ("triggering_interaction_metadata" in interactionMetadata) {
|
|
triggering_interaction_metadata = interactionMetadata.triggering_interaction_metadata;
|
|
}
|
|
tmp = triggering_interaction_metadata;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const hasCommandIndexForApp = function hasCommandIndexForApp(id, guildState) {
|
|
const result = guildState.result;
|
|
let sections;
|
|
if (null != result) {
|
|
sections = result.sections;
|
|
}
|
|
let tmp2 = null != sections;
|
|
if (tmp2) {
|
|
tmp2 = id in sections;
|
|
}
|
|
return tmp2;
|
|
};
|