104 lines
5.8 KiB
TypeScript
104 lines
5.8 KiB
TypeScript
/* Metro module 13023; source: modules/rpc/server/commands/guilds.tsx; dependencies: [1422, 1867, 661, 4122, 8079, 8076, 2] */
|
|
import GuildStore from '../../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import RPCError from '../../RPCError.tsx'; /* Metro dependency 8076 */
|
|
import CreateRpcJoiSchemaObject from '../../helpers/createRpcJoiSchemaObject.tsx'; /* Metro dependency 8079 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as GuildRecordModule from '../../../../records/GuildRecord.tsx'; /* Metro dependency 1422 */
|
|
import * as OAuth2ScopesModule from '../../../../external/discord_common/js/shared/shared-constants/OAuth2Scopes.tsx'; /* Metro dependency 4122 */
|
|
|
|
function _fun99412(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99412, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:6, offset: 0x021c7a4b, size: 276 bytes, params: 8, frame: 21
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const RPCCommands = ConstantsModule.RPCCommands;
|
|
object = {};
|
|
const GET_GUILD = RPCCommands.GET_GUILD;
|
|
const OAuth2Scopes = (OAuth2ScopesModule).OAuth2Scopes;
|
|
let RPC = OAuth2Scopes.RPC;
|
|
object[GET_GUILD] = {scope: RPC, validation: validation_99413, handler: function({socket, server, args}) {
|
|
var value;
|
|
var env0_0 = args.guild_id;
|
|
var timeout = args.timeout;
|
|
value = server.storeWait(socket, _fun99415, timeout !== undefined ? timeout : 0);
|
|
value = value.catch(_fun99416);
|
|
return value.then(_fun99417);
|
|
}};
|
|
const GET_GUILDS = RPCCommands.GET_GUILDS;
|
|
RPC = OAuth2Scopes.RPC;
|
|
object[GET_GUILDS] = {scope: RPC, handler: handler_99418};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/rpc/server/commands/guilds.tsx');
|
|
exports.default = object;
|
|
function validation_99413(a0) { // fn#99413, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:232, offset: 0x021c7b5f, size: 110 bytes, params: 2, frame: 14
|
|
let value = (CreateRpcJoiSchemaObject)(a0);
|
|
value = value.required();
|
|
const keys = value.keys;
|
|
const object = {};
|
|
object.guild_id = a0.string();
|
|
object.timeout = a0.number().min(0).max(60);
|
|
return Reflect.apply(keys, value, [object]);
|
|
}
|
|
|
|
function handler_99414({socket, server, args}) { // fn#99414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:327, offset: 0x021c7bcd, size: 103 bytes, params: 2, frame: 16
|
|
const env0_0 = args.guild_id;
|
|
let timeout = args.timeout;
|
|
timeout = timeout === undefined ? 0 : timeout;
|
|
let value = server.storeWait(socket, function() {
|
|
return GuildStore.getGuild(guild_id);
|
|
}, timeout);
|
|
value = value.catch(_fun99416);
|
|
return value.then(_fun99417);
|
|
function _fun99415() { // fn#99415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:395, offset: 0x01c08a2c, size: 27 bytes, params: 1, frame: 11
|
|
return GuildStore.getGuild(guild_id);
|
|
}
|
|
|
|
function _fun99416() { // fn#99416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:424, offset: 0x021c7c34, size: 73 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
const defaultImport = RPCError;
|
|
const GET_GUILD_TIMED_OUT = RPCErrors.GET_GUILD_TIMED_OUT;
|
|
throw new defaultImport({errorCode: GET_GUILD_TIMED_OUT}, 'Request to get guild timed out.');
|
|
}
|
|
|
|
function _fun99417(a0) { // fn#99417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:526, offset: 0x021c7c7d, size: 184 bytes, params: 2, frame: 15
|
|
var defaultImport;
|
|
let value = null;
|
|
if (value == a0) {
|
|
value = environment.__proto__;
|
|
defaultImport = importDefault(8076) /* metro dependency 8076: RPCError */;
|
|
value = 'Invalid guild id: ' + guild_id;
|
|
value = new defaultImport({errorCode: RPCErrors.INVALID_GUILD}, value);
|
|
throw value;
|
|
}
|
|
const object = {};
|
|
object.id = a0.id;
|
|
object.name = a0.name;
|
|
const guildIconURL = getGuildIconURL(a0, 128);
|
|
object.icon_url = value != guildIconURL ? guildIconURL : value;
|
|
object.members = [];
|
|
object.vanity_url_code = a0.vanityURLCode;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
function handler_99418() { // fn#99418, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:785, offset: 0x021c7d35, size: 45 bytes, params: 1, frame: 12
|
|
const object = {};
|
|
object.guilds = GuildStore.getGuildsArray().map(_fun99419);
|
|
return object;
|
|
function _fun99419(a0) { // fn#99419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13213:822, offset: 0x021c7d62, size: 60 bytes, params: 2, frame: 14
|
|
const object = {};
|
|
object.id = a0.id;
|
|
object.name = a0.name;
|
|
let value = environment.__proto__;
|
|
value = getGuildIconURL(a0, 128);
|
|
const value2 = null;
|
|
object.icon_url = value2 != value ? value : value2;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun99412, 13023, [1422, 1867, 661, 4122, 8079, 8076,
|
|
2]) /* metro module 13023, dependencies: [1422, 1867, 661, 4122, 8079, 8076, 2] */;
|