decord/source/modules/rpc/server/commands/soundboard.tsx
github-actions 4f02868c60 chore: update source for alpha 346.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
2026-09-11 10:30:06 +00:00

137 lines
4.8 KiB
TypeScript

// Module ID: 14562
// Function ID: 14563
// Name: soundboard
// Dependencies: [5, 5064, 1371, 4512, 1085, 8427, 7412, 5072, 9650, 7447, 7418, 9647, 7449, 7256, 2]
// Module 14562 (soundboard)
import SoundboardActionCreators from "SoundboardActionCreators" /* 7412 */;
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 9650 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import SoundboardStore from "SoundboardStore" /* 5064 */;
import UserStore from "UserStore" /* 1371 */;
require = fn;
let Constants = fn(4512);
({ 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(8427).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(8427).OAuth2Scopes.RPC, fn(8427).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(7412).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(7447)();
let result = null != sound2;
if (result) {
result = null != currentUser2;
}
if (result) {
result = tmp2(7418).canUseSoundboardSound(currentUser2, sound2, closure_128_2);
const obj = tmp2(7418);
}
closure_128_3 = result;
if (null == closure_128_2) {
const obj8 = { errorCode: constants.INVALID_CHANNEL };
const tmp52 = new tmp5(9647)(obj8, "Invalid Channel.");
throw tmp52;
} else if (closure_128_3) {
if (tmp74(7449)(closure_128_2)) {
if (null != sound2) {
const items = [tmp5(7256).RPC];
tmp2(7418).playSound(sound2, closure_128_2.id, items);
const obj4 = tmp2(7418);
}
c3 = 3;
return { value: "HermesInternal", done: null };
} else {
const obj9 = { errorCode: constants.INVALID_PERMISSIONS };
const tmp32 = new tmp5(9647)(obj9, "Invalid Permissions.");
throw tmp32;
}
} else {
const obj10 = { errorCode: constants.INVALID_SOUND };
const tmp22 = new tmp74(9647)(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;