95 lines
4.8 KiB
TypeScript
95 lines
4.8 KiB
TypeScript
/* Metro module 13023; source: modules/rpc/server/commands/guilds.tsx; dependencies: [1422, 1867, 661, 4122, 8079, 8076, 2] */
|
|
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
|
|
var object2;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = (require(1422) /* metro dependency 1422: GuildRecord */).getGuildIconURL;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const RPCCommands = constantsModule.RPCCommands;
|
|
const env0_4 = constantsModule.RPCErrors;
|
|
object2 = {};
|
|
const GET_GUILD = RPCCommands.GET_GUILD;
|
|
const OAuth2Scopes = (require(4122) /* metro dependency 4122: OAuth2Scopes */).OAuth2Scopes;
|
|
let RPC = OAuth2Scopes.RPC;
|
|
object2[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;
|
|
object2[GET_GUILDS] = {scope: RPC, handler: handler_99418};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/rpc/server/commands/guilds.tsx');
|
|
exports.default = object2;
|
|
}
|
|
|
|
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 = (importDefault(8079) /* metro dependency 8079: createRpcJoiSchemaObject */)(a0);
|
|
value = value.required();
|
|
const keys = value.keys;
|
|
const object2 = {};
|
|
object2.guild_id = a0.string();
|
|
object2.timeout = a0.number().min(0).max(60);
|
|
return Reflect.apply(keys, value, [object2]);
|
|
}
|
|
|
|
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 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 object2 = {};
|
|
object2.guilds = GuildStore.getGuildsArray().map(_fun99419);
|
|
return object2;
|
|
}
|
|
|
|
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 = importDefault(8076) /* metro dependency 8076: 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 object2 = {};
|
|
object2.id = a0.id;
|
|
object2.name = a0.name;
|
|
const guildIconURL = getGuildIconURL(a0, 128);
|
|
object2.icon_url = value != guildIconURL ? guildIconURL : value;
|
|
object2.members = [];
|
|
object2.vanity_url_code = a0.vanityURLCode;
|
|
return object2;
|
|
}
|
|
|
|
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 object2 = {};
|
|
object2.id = a0.id;
|
|
object2.name = a0.name;
|
|
let value = environment.__proto__;
|
|
value = getGuildIconURL(a0, 128);
|
|
const value2 = null;
|
|
object2.icon_url = value2 != value ? value : value2;
|
|
return object2;
|
|
}
|
|
|