decord/source/modules/rpc/server/commands/soundboard.tsx
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

137 lines
4.8 KiB
TypeScript

// Module ID: 14535
// Function ID: 14536
// Name: soundboard
// Dependencies: [5, 5026, 1371, 4479, 1085, 8367, 7352, 5034, 9589, 7387, 7358, 9586, 7389, 7196, 2]
// Module 14535 (soundboard)
import SoundboardActionCreators from "SoundboardActionCreators" /* 7352 */;
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 9589 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import SoundboardStore from "SoundboardStore" /* 5026 */;
import UserStore from "UserStore" /* 1371 */;
require = fn;
let Constants = fn(4479);
({ RPC_SCOPE_CONFIG, RPC_LOCAL_SCOPE } = Constants);
Constants = fn(1085);
({ RPCCommands, RPCErrors: metroRequire } = Constants);
let obj = {};
let obj2 = { scope: null, handler: null };
let obj3 = {};
let items = [fn(8367).OAuth2Scopes.RPC, RPC_LOCAL_SCOPE];
obj3[RPC_SCOPE_CONFIG.ANY] = items;
obj2.scope = obj3;
obj2.handler = function handler() {
return (async () => {
closure_1 = tmp5;
closure_0 = tmp2;
await SoundboardActionCreators.maybeFetchSoundboardSounds();
const sounds = closure_129_4.getSounds();
closure_128_1 = [];
const item = sounds.forEach((arr) => arr.forEach((item) => closure_1_1.push(closure_2_0(closure_2_2[7]).soundboardSoundToAPI(item))));
return closure_128_1;
})();
};
obj[RPCCommands.GET_SOUNDBOARD_SOUNDS] = obj2;
let obj4 = { scope: null, validation: null, handler: null };
let obj5 = {};
const items1 = [fn(8367).OAuth2Scopes.RPC, fn(8367).OAuth2Scopes.RPC_VOICE_WRITE];
obj5[RPC_SCOPE_CONFIG.ALL] = items1;
obj4.scope = obj5;
obj4.validation = function validation(string) {
const obj = createRpcJoiSchemaObjectDefault(string);
const requiredResult = createRpcJoiSchemaObjectDefault(string).required();
return requiredResult.keys({ guild_id: string.string(), sound_id: string.string() });
};
obj4.handler = function handler(args) {
({ guild_id: require, sound_id: importDefault } = args.args);
return (async (arg0, value) => {
if (c3 === 2) {
c3 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c3 = 2;
if (0 === dependencyMap) {
if (arg0 === 1) {
c3 = 3;
throw value;
} else if (arg0 === 2) {
c3 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
let currentUser2;
let sound2;
closure_128_2 = undefined;
closure_128_3 = undefined;
dependencyMap = 1;
c3 = 1;
const obj5 = { value: tmp2(7352).maybeFetchSoundboardSounds(), done: false };
return obj5;
}
} else if (arg0 === 1) {
c3 = 3;
throw value;
} else if (arg0 === 2) {
c3 = 3;
const obj6 = { value, done: true };
return obj6;
} else {
currentUser2 = currentUser.getCurrentUser();
sound2 = sound.getSound(closure_129_0, closure_129_1);
closure_128_2 = tmp5(7387)();
let result = null != sound2;
if (result) {
result = null != currentUser2;
}
if (result) {
result = tmp2(7358).canUseSoundboardSound(currentUser2, sound2, closure_128_2);
const obj = tmp2(7358);
}
closure_128_3 = result;
if (null == closure_128_2) {
const obj8 = { errorCode: constants.INVALID_CHANNEL };
const tmp52 = new tmp5(9586)(obj8, "Invalid Channel.");
throw tmp52;
} else if (closure_128_3) {
if (tmp74(7389)(closure_128_2)) {
if (null != sound2) {
const items = [tmp5(7196).RPC];
tmp2(7358).playSound(sound2, closure_128_2.id, items);
const obj4 = tmp2(7358);
}
c3 = 3;
return { value: "HermesInternal", done: null };
} else {
const obj9 = { errorCode: constants.INVALID_PERMISSIONS };
const tmp32 = new tmp5(9586)(obj9, "Invalid Permissions.");
throw tmp32;
}
} else {
const obj10 = { errorCode: constants.INVALID_SOUND };
const tmp22 = new tmp74(9586)(obj10, "Invalid Sound.");
throw tmp22;
}
}
} catch (tmp56) {
c3 = tmp;
throw tmp56;
}
}
})();
};
obj[RPCCommands.PLAY_SOUNDBOARD_SOUND] = obj4;
const size = fn(2);
let result = size.fileFinishedImporting("modules/rpc/server/commands/soundboard.tsx");
export default obj;