134 lines
7.3 KiB
TypeScript
134 lines
7.3 KiB
TypeScript
/* Metro module 13055; source: modules/rpc/server/commands/soundboard.tsx; dependencies: [5, 4613, 1878, 4135, 482, 4122, 6944, 6639, 8079, 6980, 6951, 8076, 6982, 6789, 2] */
|
|
import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import UserStore from '../../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import SoundboardStore from '../../../soundboard/SoundboardStore.tsx'; /* Metro dependency 4613 */
|
|
import CreateRpcJoiSchemaObject from '../../helpers/createRpcJoiSchemaObject.tsx'; /* Metro dependency 8079 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as OAuth2ScopesModule from '../../../../external/discord_common/js/shared/shared-constants/OAuth2Scopes.tsx'; /* Metro dependency 4122 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 4135 */
|
|
|
|
function _fun99677(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:6, offset: 0x021d11fe, size: 385 bytes, params: 8, frame: 26
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ConstantsModule;
|
|
const RPC_LOCAL_SCOPE = value.RPC_LOCAL_SCOPE;
|
|
const RPC_SCOPE_CONFIG = value.RPC_SCOPE_CONFIG;
|
|
value = require(482) /* metro dependency 482: Constants */;
|
|
const RPCCommands = value.RPCCommands;
|
|
const env0_6 = value.RPCErrors;
|
|
object = {};
|
|
const GET_SOUNDBOARD_SOUNDS = RPCCommands.GET_SOUNDBOARD_SOUNDS;
|
|
const ANY = RPC_SCOPE_CONFIG.ANY;
|
|
const OAuth2Scopes = (OAuth2ScopesModule).OAuth2Scopes;
|
|
let RPC = OAuth2Scopes.RPC;
|
|
object[GET_SOUNDBOARD_SOUNDS] = {scope: {[ANY]: [RPC, RPC_LOCAL_SCOPE]}, handler: handler_99678};
|
|
const PLAY_SOUNDBOARD_SOUND = RPCCommands.PLAY_SOUNDBOARD_SOUND;
|
|
const ALL = RPC_SCOPE_CONFIG.ALL;
|
|
RPC = OAuth2Scopes.RPC;
|
|
const RPC_VOICE_WRITE = OAuth2Scopes.RPC_VOICE_WRITE;
|
|
object[PLAY_SOUNDBOARD_SOUND] = {scope: {[ALL]: [RPC, RPC_VOICE_WRITE]}, validation: validation_99683,
|
|
handler: handler_99684};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/rpc/server/commands/soundboard.tsx');
|
|
exports.default = object;
|
|
function handler_99678() { // fn#99678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:300, offset: 0x021d137f, size: 29 bytes, params: 1, frame: 11
|
|
return Module00005(_fun99680)();
|
|
function* _fun99680() { // fn#99680, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:307, offset: 0x021d13a7, size: 106 bytes, params: 1, frame: 15
|
|
var environment;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const value3 = env2_0(env2_2[6]);
|
|
yield value3.maybeFetchSoundboardSounds();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
env2_4.getSounds().forEach(function(a0) {
|
|
return a0.forEach(_fun99682);
|
|
});
|
|
return [];
|
|
function _fun99681(a0) { // fn#99681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:405, offset: 0x021d1411, size: 24 bytes, params: 2, frame: 11
|
|
return a0.forEach(_fun99682);
|
|
function _fun99682(a0) { // fn#99682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:419, offset: 0x021d1429, size: 58 bytes, params: 2, frame: 13
|
|
let value = environment.__proto__;
|
|
const binding = env1_0;
|
|
const push = binding.push;
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
value = env4_0(env4_2[7]);
|
|
return Reflect.apply(push, binding, [value.soundboardSoundToAPI(a0)]);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function validation_99683(a0) { // fn#99683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:592, offset: 0x021d1463, size: 84 bytes, params: 2, frame: 13
|
|
let value = (CreateRpcJoiSchemaObject)(a0);
|
|
value = value.required();
|
|
const keys = value.keys;
|
|
const object = {};
|
|
object.guild_id = a0.string();
|
|
object.sound_id = a0.string();
|
|
return Reflect.apply(keys, value, [object]);
|
|
}
|
|
|
|
function handler_99684({args}) { // fn#99684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:673, offset: 0x021d14b7, size: 57 bytes, params: 2, frame: 11
|
|
const env0_0 = args.guild_id;
|
|
const env0_1 = args.sound_id;
|
|
return Module00005(_fun99686)();
|
|
function* _fun99686() { // fn#99686, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13245:710, offset: 0x021d14fb, size: 486 bytes, params: 1, frame: 23
|
|
var binding3;
|
|
var value17;
|
|
var playSound;
|
|
var id;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
let binding = env2_0;
|
|
const value3 = binding(env2_2[6]);
|
|
yield value3.maybeFetchSoundboardSounds();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const currentUser = env2_5.getCurrentUser();
|
|
const sound = env2_4.getSound(require, importDefault);
|
|
const value9 = env2_1(env2_2[9])();
|
|
const r6 = sound != null && currentUser != null && env2_0(env2_2[10]).canUseSoundboardSound(currentUser, sound,
|
|
value9);
|
|
if (value9 == null) {
|
|
throw new env2_1(env2_2[11])({errorCode: env2_6.INVALID_CHANNEL}, 'Invalid Channel.');
|
|
}
|
|
binding = env2_1;
|
|
const binding2 = env2_2;
|
|
if (r6) {
|
|
if (binding(binding2[12])(value9)) {
|
|
if (sound != null) {
|
|
binding = env2_0;
|
|
binding3 = env2_2;
|
|
value17 = binding(binding3[10]);
|
|
playSound = value17.playSound;
|
|
id = value9.id;
|
|
binding = env2_1;
|
|
Reflect.apply(playSound, value17, [sound, id, [binding(binding3[13]).RPC]]);
|
|
}
|
|
return undefined;
|
|
}
|
|
binding = env2_1;
|
|
throw new binding(env2_2[11])({errorCode: env2_6.INVALID_PERMISSIONS}, 'Invalid Permissions.');
|
|
}
|
|
const value13 = binding(binding2[11]);
|
|
const INVALID_SOUND = env2_6.INVALID_SOUND;
|
|
throw new value13({errorCode: INVALID_SOUND}, 'Invalid Sound.');
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun99677, 13055, [5, 4613, 1878, 4135, 482, 4122, 6944, 6639, 8079, 6980, 6951, 8076, 6982, 6789,
|
|
2]) /* metro module 13055, dependencies: [5, 4613, 1878, 4135, 482, 4122, 6944, 6639, 8079, 6980, 6951, 8076, 6982, 6789, 2] */;
|