Files
discord-decomp/sources/modules/rpc/server/commands/invites.tsx
T
2026-07-27 16:20:00 +03:00

418 lines
17 KiB
TypeScript

/* Metro module 13025; source: modules/rpc/server/commands/invites.tsx; dependencies: [5, 1378, 1379, 4135, 661, 482, 13026, 4122, 8077, 10647, 13029, 677, 7860, 2] */
function _fun99426(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99426, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13215:6, offset: 0x021c812b, size: 339 bytes, params: 8, frame: 26
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(5) /* metro dependency 5 */;
const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const RPC_SCOPE_CONFIG = (require(4135) /* metro dependency 4135: Constants */).RPC_SCOPE_CONFIG;
const env0_5 = (require(661) /* metro dependency 661: Constants */).InstantInviteSources;
let value = require(482) /* metro dependency 482: Constants */;
const RPCCommands = value.RPCCommands;
const env0_6 = value.RPCErrors;
object2 = {};
const INVITE_USER_EMBEDDED = RPCCommands.INVITE_USER_EMBEDDED;
value = require(13026) /* metro dependency 13026: rpcSchema */;
const createRPCCommand = value.createRPCCommand;
const INVITE_USER_EMBEDDED2 = RPCCommands.INVITE_USER_EMBEDDED;
const ANY = RPC_SCOPE_CONFIG.ANY;
const {DM_CHANNELS_MESSAGES_WRITE,
ACTIVITIES_INVITES_WRITE} = (require(4122) /* metro dependency 4122: OAuth2Scopes */).OAuth2Scopes;
object2[INVITE_USER_EMBEDDED] = Reflect.apply(createRPCCommand, value, [INVITE_USER_EMBEDDED2,
{scope: {[ANY]: [DM_CHANNELS_MESSAGES_WRITE, ACTIVITIES_INVITES_WRITE]}, handler: function({socket, args}) {
var env0_1 = args.user_id;
return args.content(_fun99428)();
}}]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/rpc/server/commands/invites.tsx');
exports.default = object2;
}
function handler_99427({socket, args}) { // fn#99427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13215:421, offset: 0x021c827e, size: 67 bytes, params: 2, frame: 11
const env0_1 = args.user_id;
return args.content(_fun99429)();
}
function* _fun99429() { // fn#99429, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13215:465, offset: 0x021c82cc, size: 887 bytes, params: 1, frame: 21
var r8;
var binding;
var RPCError;
var object3;
var prototype;
var rPCError;
var value5;
var type;
var value6;
var binding2;
var property;
var value7;
var sendEmbeddedActivityInviteUser;
var id2;
var object4;
var ACTIVITY_INVITE;
var value8;
var error;
var UNKNOWN_ERROR;
if (false) {
return undefined;
}
value = environment.__proto__;
const id = require.application.id;
if (id == null) {
value = environment.__proto__.__proto__;
throw new env2_0(env2_1[8]).RPCError({errorCode: env2_6.INVALID_COMMAND}, 'No application.');
}
const connectedActivityLocation = env2_3.getConnectedActivityLocation();
if (connectedActivityLocation == null) {
throw new env2_0(env2_1[8]).RPCError({errorCode: env2_6.NO_ELIGIBLE_ACTIVITY},
'No eligible activity for application. Ensure an activity was set using setActivity.');
}
const kind = connectedActivityLocation.kind;
const EmbeddedActivityLocationKind = env2_0(env2_1[9]).EmbeddedActivityLocationKind;
const GUILD_CHANNEL = EmbeddedActivityLocationKind.GUILD_CHANNEL;
if (GUILD_CHANNEL === kind) {
binding = env2_0;
value6 = binding(env2_1[10]);
r8 = value6.validateOpenInviteDialog().channel;
} else {
binding = env2_0;
if (binding(env2_1[9]).EmbeddedActivityLocationKind.GUILD_CHANNEL_MESSAGE === kind) {
binding = env2_0;
value6 = binding(env2_1[10]);
r8 = value6.validateOpenInviteDialog().channel;
} else {
binding = env2_0;
if (binding(env2_1[9]).EmbeddedActivityLocationKind.PRIVATE_CHANNEL === kind) {
binding = env2_4;
value5 = binding.getChannel(connectedActivityLocation.channel_id);
if (value5 == null) {
throw new env2_0(env2_1[8]).RPCError({errorCode: env2_6.INVALID_CHANNEL}, 'Invalid channel');
}
type = value5.type;
binding = env2_0;
if (type === binding(env2_1[11]).ChannelTypes.DM) {
throw new env2_0(env2_1[8]).RPCError({errorCode: env2_6.INVALID_CHANNEL},
'Cannot send invite to a DM');
}
r8 = value5;
} else {
binding = env2_0;
if (binding(env2_1[9]).EmbeddedActivityLocationKind.PRIVATE_CHANNEL_MESSAGE !== kind) {
throw new env2_0(env2_1[8]).RPCError({errorCode: env2_6.NO_ELIGIBLE_ACTIVITY},
'Unsupported activity location');
}
binding = env2_4;
value5 = binding.getChannel(connectedActivityLocation.channel_id);
if (value5 == null) {
throw new env2_0(env2_1[8]).RPCError({errorCode: env2_6.INVALID_CHANNEL}, 'Invalid channel');
}
type = value5.type;
binding = env2_0;
if (type === binding(env2_1[11]).ChannelTypes.DM) {
throw new env2_0(env2_1[8]).RPCError({errorCode: env2_6.INVALID_CHANNEL},
'Cannot send invite to a DM');
}
r8 = value5;
}
}
}
try {
binding = env2_0;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
binding2 = env2_1;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
property = binding2[12];
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
value7 = binding(property);
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
sendEmbeddedActivityInviteUser = value7.sendEmbeddedActivityInviteUser;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object3 = {};
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
id2 = r8.id;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object3.channelId = id2;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object3.applicationId = id;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object3.userId = dependencyMap;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
binding = env1_2;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object3.prefixedContent = binding;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object3.location = 'RPC_ACTIVITY_INVITE_USER';
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object4 = {};
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
binding = env2_5;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
ACTIVITY_INVITE = binding.ACTIVITY_INVITE;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object4.source = ACTIVITY_INVITE;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
object3.inviteAnalyticsMetadata = object4;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
try {
value = Reflect.apply(sendEmbeddedActivityInviteUser, value7, [object3]);
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
yield value;
try {
value = undefined;
value8 = false;
} catch (error) {
binding = env2_0;
RPCError = binding(env2_1[8]).RPCError;
object3 = {};
UNKNOWN_ERROR = env2_6.UNKNOWN_ERROR;
object3.errorCode = UNKNOWN_ERROR;
prototype = RPCError.prototype;
value = Object.create(prototype, {constructor: {value: RPCError}});
rPCError = new RPCError(object3, 'Failed to invite user');
value = rPCError instanceof Object ? rPCError : value;
throw value;
}
return value8 ? value : undefined;
}