145 lines
4.9 KiB
TypeScript
145 lines
4.9 KiB
TypeScript
// Module ID: 13975
|
|
// Function ID: 13976
|
|
// Name: RPC_LOCAL_SCOPE
|
|
// Dependencies: [5, 4851, 1922, 4282, 505, 9049, 6062, 4858, 10827, 6097, 6068, 10824, 6099, 5854, 2]
|
|
|
|
// Module 13975 (RPC_LOCAL_SCOPE)
|
|
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 10827 */;
|
|
import closure_3 from "asyncGeneratorStep" /* 5 */;
|
|
import closure_4 from "handleSoundCreateOrUpdate" /* 4851 */;
|
|
import closure_5 from "mergeGuildAvatar" /* 1922 */;
|
|
import RPC_SCOPE_CONFIG from "RPC_SCOPE_CONFIG" /* 4282 */;
|
|
import sum from "sum" /* 505 */;
|
|
|
|
const require = arg1;
|
|
({ RPC_SCOPE_CONFIG, RPC_LOCAL_SCOPE } = RPC_SCOPE_CONFIG);
|
|
({ RPCCommands, RPCErrors: closure_6 } = sum);
|
|
let obj = {};
|
|
obj = { scope: null, handler: null };
|
|
obj = {};
|
|
let items = [require("set").OAuth2Scopes.RPC, RPC_LOCAL_SCOPE];
|
|
obj[RPC_SCOPE_CONFIG.ANY] = items;
|
|
obj[0] = obj;
|
|
obj[1] = function handler() {
|
|
return callback(function*() {
|
|
closure_1 = tmp5;
|
|
let sounds2 = tmp2;
|
|
const obj2 = closure_1_0(table[6]);
|
|
yield obj2.maybeFetchSoundboardSounds();
|
|
sounds2 = sounds.getSounds();
|
|
closure_1 = [];
|
|
const item = sounds2.forEach((arr) => arr.forEach((arg0) => arr.push(closure_1_0(closure_1_2[7]).soundboardSoundToAPI(arg0))));
|
|
return closure_1;
|
|
})();
|
|
};
|
|
obj[RPCCommands.GET_SOUNDBOARD_SOUNDS] = obj;
|
|
let obj1 = { scope: null, validation: null, handler: null };
|
|
let obj2 = {};
|
|
const items1 = [require("set").OAuth2Scopes.RPC, require("set").OAuth2Scopes.RPC_VOICE_WRITE];
|
|
obj2[RPC_SCOPE_CONFIG.ALL] = items1;
|
|
obj1[0] = obj2;
|
|
obj1[1] = function validation(string) {
|
|
let obj = createRpcJoiSchemaObjectDefault(string);
|
|
obj = { guild_id: string.string(), sound_id: string.string() };
|
|
return obj.required().keys(obj);
|
|
};
|
|
obj1[2] = function handler(args) {
|
|
({ guild_id: require, sound_id: importDefault } = args.args);
|
|
return callback(function*() {
|
|
if (c3 === 2) {
|
|
c3 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: "HermesInternal" };
|
|
}
|
|
} else {
|
|
try {
|
|
c3 = 2;
|
|
if (0 === closure_2) {
|
|
if (arg0 === 1) {
|
|
c3 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c3 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let sound = tmp5;
|
|
let currentUser = tmp2;
|
|
currentUser = undefined;
|
|
sound = undefined;
|
|
closure_2 = undefined;
|
|
c3 = undefined;
|
|
closure_2 = 1;
|
|
c3 = 1;
|
|
obj1 = { value: null, done: false };
|
|
obj1[0] = closure_1_0(id[6]).maybeFetchSoundboardSounds();
|
|
return obj1;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c3 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c3 = 3;
|
|
const obj2 = { value: null, done: true };
|
|
obj2[0] = arg1;
|
|
return obj2;
|
|
} else {
|
|
currentUser = closure_1_5.getCurrentUser();
|
|
sound = closure_1_4.getSound(currentUser, sound);
|
|
closure_2 = closure_1_1(id[9])();
|
|
let result = null != sound;
|
|
if (result) {
|
|
result = null != currentUser;
|
|
}
|
|
if (result) {
|
|
obj = closure_1_0(id[10]);
|
|
result = obj.canUseSoundboardSound(currentUser, sound, closure_2);
|
|
}
|
|
c3 = result;
|
|
if (null == closure_2) {
|
|
let obj3 = { errorCode: null };
|
|
obj3[0] = closure_1_6.INVALID_CHANNEL;
|
|
const tmp52 = new closure_1_1(id[11])(obj3, "Invalid Channel.");
|
|
throw tmp52;
|
|
} else if (c3) {
|
|
if (tmp75(tmp76[12])(closure_2)) {
|
|
if (null != closure_1_1) {
|
|
obj3 = closure_1_0(id[10]);
|
|
const items = [closure_1_1(id[13]).RPC];
|
|
obj3.playSound(closure_1_1, id.id, items);
|
|
}
|
|
c3 = 3;
|
|
return { value: "HermesInternal", done: "HermesInternal" };
|
|
} else {
|
|
const obj4 = { errorCode: null };
|
|
obj4[0] = closure_1_6.INVALID_PERMISSIONS;
|
|
const tmp32 = new closure_1_1(id[11])(obj4, "Invalid Permissions.");
|
|
throw tmp32;
|
|
}
|
|
} else {
|
|
const obj5 = { errorCode: null };
|
|
obj5[0] = closure_1_6.INVALID_SOUND;
|
|
const tmp22 = new tmp75(tmp76[11])(obj5, "Invalid Sound.");
|
|
throw tmp22;
|
|
}
|
|
}
|
|
} catch (tmp56) {
|
|
c3 = tmp;
|
|
throw tmp56;
|
|
}
|
|
}
|
|
})();
|
|
};
|
|
obj[RPCCommands.PLAY_SOUNDBOARD_SOUND] = obj1;
|
|
let result = require("set").fileFinishedImporting("modules/rpc/server/commands/soundboard.tsx");
|
|
|
|
export default obj;
|