decord/source/modules/rpc/server/commands/invites.tsx

147 lines
6.1 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13908
// Function ID: 13909
2026-07-20 16:05:17 +00:00
// Name: items
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 1390, 1391, 4281, 676, 505, 13909, 4379, 8790, 8775, 13913, 692, 8738, 2]
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
// Module 13908 (items)
import closure_2 from "asyncGeneratorStep" /* 5 */;
import closure_3 from "participantFromServer" /* 1390 */;
import closure_4 from "ensureGuildLoaded" /* 1391 */;
import { InstantInviteSources } from "ME" /* 676 */;
import sum from "sum" /* 505 */;
import CONTEXT_MENU_ICON_NAMES from "CONTEXT_MENU_ICON_NAMES" /* 13909 */;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
({ RPCCommands, RPCErrors: closure_6 } = sum);
2026-07-20 16:05:17 +00:00
let obj = {};
2026-07-29 08:29:29 +00:00
obj = { scope: null, handler: null };
2026-07-20 16:05:17 +00:00
obj = {};
2026-07-23 10:11:24 +00:00
const items = [require("set").OAuth2Scopes.DM_CHANNELS_MESSAGES_WRITE, require("set").OAuth2Scopes.ACTIVITIES_INVITES_WRITE];
obj[require("RPC_SCOPE_CONFIG").RPC_SCOPE_CONFIG.ANY] = items;
2026-07-29 08:29:29 +00:00
obj[0] = obj;
obj[1] = function handler(arg0) {
2026-07-23 10:11:24 +00:00
({ socket: require, args } = arg0);
({ user_id: dependencyMap, content: closure_2 } = args);
2026-07-29 08:29:29 +00:00
return callback(function*() {
if (connectedActivityLocation === 2) {
connectedActivityLocation = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
connectedActivityLocation = 2;
if (0 === dependencyMap) {
if (arg0 === 1) {
connectedActivityLocation = 3;
throw arg1;
} else if (arg0 === 2) {
connectedActivityLocation = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_0 = tmp3;
const id = closure_1_0.application.id;
2026-07-29 08:29:29 +00:00
if (null == id) {
2026-08-24 06:08:38 +00:00
obj1 = { errorCode: null };
obj1[0] = closure_1_6.INVALID_COMMAND;
const rPCError = new closure_1_0(8790).RPCError(obj1, "No application.");
2026-07-29 08:29:29 +00:00
throw rPCError;
} else {
connectedActivityLocation = connectedActivityLocation.getConnectedActivityLocation();
if (null == connectedActivityLocation) {
const obj2 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_6.NO_ELIGIBLE_ACTIVITY;
const rPCError1 = new closure_1_0(8790).RPCError(obj2, "No eligible activity for application. Ensure an activity was set using setActivity.");
2026-07-29 08:29:29 +00:00
throw rPCError1;
} else {
const kind = connectedActivityLocation.kind;
2026-08-24 06:08:38 +00:00
if (closure_1_0(8775).EmbeddedActivityLocationKind.GUILD_CHANNEL !== kind) {
if (closure_1_0(8775).EmbeddedActivityLocationKind.GUILD_CHANNEL_MESSAGE !== kind) {
if (closure_1_0(8775).EmbeddedActivityLocationKind.PRIVATE_CHANNEL !== kind) {
if (closure_1_0(8775).EmbeddedActivityLocationKind.PRIVATE_CHANNEL_MESSAGE !== kind) {
2026-07-29 08:29:29 +00:00
const obj3 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj3[0] = closure_1_6.NO_ELIGIBLE_ACTIVITY;
const rPCError2 = new closure_1_0(8790).RPCError(obj3, "Unsupported activity location");
2026-07-29 08:29:29 +00:00
throw rPCError2;
}
}
2026-08-24 06:08:38 +00:00
let channel = closure_1_4.getChannel(connectedActivityLocation.channel_id);
2026-07-29 08:29:29 +00:00
if (null == channel) {
let obj4 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj4[0] = closure_1_6.INVALID_CHANNEL;
const rPCError3 = new closure_1_0(8790).RPCError(obj4, "Invalid channel");
2026-07-29 08:29:29 +00:00
throw rPCError3;
2026-08-24 06:08:38 +00:00
} else if (channel.type === closure_1_0(692).ChannelTypes.DM) {
2026-07-29 08:29:29 +00:00
let obj5 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj5[0] = closure_1_6.INVALID_CHANNEL;
const rPCError4 = new closure_1_0(8790).RPCError(obj5, "Cannot send invite to a DM");
2026-07-29 08:29:29 +00:00
throw rPCError4;
}
}
2026-08-24 06:08:38 +00:00
c2 = 1;
obj5 = closure_1_0(8738);
2026-07-29 08:29:29 +00:00
const obj6 = { channelId: null, applicationId: null, userId: null, prefixedContent: null, location: "RPC_ACTIVITY_INVITE_USER", inviteAnalyticsMetadata: null };
obj6[0] = channel.id;
obj6[1] = id;
obj6[2] = dependencyMap;
obj6[3] = c2;
const obj7 = { source: null };
2026-08-24 06:08:38 +00:00
obj7[0] = closure_1_5.ACTIVITY_INVITE;
2026-07-29 08:29:29 +00:00
obj6[5] = obj7;
dependencyMap = 2;
connectedActivityLocation = 1;
const obj8 = { value: null, done: false };
obj8[0] = obj5.sendEmbeddedActivityInviteUser(obj6);
return obj8;
}
2026-08-24 06:08:38 +00:00
obj4 = closure_1_0(13913);
2026-08-07 06:50:47 +00:00
channel = obj4.validateOpenInviteDialog(tmp69).channel;
2026-07-29 08:29:29 +00:00
}
}
}
} else if (1 === tmp7) {
c2 = 0;
const obj9 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj9[0] = closure_1_6.UNKNOWN_ERROR;
const rPCError5 = new closure_1_0(8790).RPCError(obj9, "Failed to invite user");
2026-07-29 08:29:29 +00:00
throw rPCError5;
} else if (arg0 === 1) {
connectedActivityLocation = 3;
throw arg1;
} else if (arg0 === 2) {
c2 = 0;
connectedActivityLocation = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c2 = 0;
connectedActivityLocation = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
2026-08-07 06:50:47 +00:00
} catch (tmp61) {
2026-07-29 08:29:29 +00:00
if (tmp4 === c2) {
connectedActivityLocation = tmp2;
2026-08-07 06:50:47 +00:00
throw tmp61;
2026-07-29 08:29:29 +00:00
} else {
dependencyMap = tmp;
}
}
}
})();
2026-07-20 16:05:17 +00:00
};
2026-08-24 06:08:38 +00:00
obj[RPCCommands.INVITE_USER_EMBEDDED] = CONTEXT_MENU_ICON_NAMES.createRPCCommand(RPCCommands.INVITE_USER_EMBEDDED, obj);
const result = require("set").fileFinishedImporting("modules/rpc/server/commands/invites.tsx");
2026-07-20 16:05:17 +00:00
export default obj;