decord/source/modules/rpc/server/commands/soundboard.tsx

146 lines
4.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13940
// Function ID: 13941
2026-07-29 08:29:29 +00:00
// Name: RPC_LOCAL_SCOPE
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 4785, 1922, 4281, 505, 4379, 7337, 6862, 8792, 7371, 7342, 8789, 7373, 7197, 2]
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
// Module 13940 (RPC_LOCAL_SCOPE)
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 8792 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "handleSoundCreateOrUpdate" /* 4785 */;
import closure_5 from "mergeGuildAvatar" /* 1922 */;
import RPC_SCOPE_CONFIG from "RPC_SCOPE_CONFIG" /* 4281 */;
import sum from "sum" /* 505 */;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ RPC_SCOPE_CONFIG, RPC_LOCAL_SCOPE } = RPC_SCOPE_CONFIG);
2026-07-23 10:11:24 +00:00
({ RPCCommands, RPCErrors: closure_6 } = sum);
2026-07-20 16:05:17 +00:00
let obj = {};
2026-07-29 08:29:29 +00:00
obj = { scope: null, handler: null };
2026-07-20 16:05:17 +00:00
obj = {};
2026-07-29 08:29:29 +00:00
let items = [require("set").OAuth2Scopes.RPC, RPC_LOCAL_SCOPE];
2026-07-20 16:05:17 +00:00
obj[RPC_SCOPE_CONFIG.ANY] = items;
2026-07-29 08:29:29 +00:00
obj[0] = obj;
obj[1] = function handler() {
return callback(function*() {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
2026-08-04 21:03:28 +00:00
let sounds2 = tmp2;
2026-08-24 06:08:38 +00:00
const obj2 = closure_1_0(table[6]);
2026-08-04 21:03:28 +00:00
yield obj2.maybeFetchSoundboardSounds();
sounds2 = sounds.getSounds();
closure_1 = [];
2026-08-24 06:08:38 +00:00
const item = sounds2.forEach((arr) => arr.forEach((arg0) => arr.push(closure_1_0(closure_1_2[7]).soundboardSoundToAPI(arg0))));
2026-08-04 21:03:28 +00:00
return closure_1;
2026-07-29 08:29:29 +00:00
})();
2026-07-20 16:05:17 +00:00
};
obj[RPCCommands.GET_SOUNDBOARD_SOUNDS] = obj;
2026-07-29 08:29:29 +00:00
let obj1 = { scope: null, validation: null, handler: null };
let obj2 = {};
2026-07-23 10:11:24 +00:00
const items1 = [require("set").OAuth2Scopes.RPC, require("set").OAuth2Scopes.RPC_VOICE_WRITE];
2026-07-20 16:05:17 +00:00
obj2[RPC_SCOPE_CONFIG.ALL] = items1;
2026-07-29 08:29:29 +00:00
obj1[0] = obj2;
obj1[1] = function validation(string) {
2026-08-24 06:08:38 +00:00
let obj = createRpcJoiSchemaObjectDefault(string);
2026-07-20 16:05:17 +00:00
obj = { guild_id: string.string(), sound_id: string.string() };
return obj.required().keys(obj);
};
2026-07-29 08:29:29 +00:00
obj1[2] = function handler(args) {
2026-07-23 10:11:24 +00:00
({ guild_id: require, sound_id: importDefault } = args.args);
2026-07-29 08:29:29 +00:00
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 {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} 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;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = closure_1_0(id[6]).maybeFetchSoundboardSounds();
2026-07-29 08:29:29 +00:00
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 {
2026-08-24 06:08:38 +00:00
currentUser = closure_1_5.getCurrentUser();
sound = closure_1_4.getSound(currentUser, sound);
closure_2 = closure_1_1(id[9])();
2026-07-29 08:29:29 +00:00
let result = null != sound;
if (result) {
result = null != currentUser;
}
if (result) {
2026-08-24 06:08:38 +00:00
obj = closure_1_0(id[10]);
2026-07-29 08:29:29 +00:00
result = obj.canUseSoundboardSound(currentUser, sound, closure_2);
}
c3 = result;
if (null == closure_2) {
let obj3 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj3[0] = closure_1_6.INVALID_CHANNEL;
const tmp52 = new closure_1_1(id[11])(obj3, "Invalid Channel.");
2026-07-29 08:29:29 +00:00
throw tmp52;
} else if (c3) {
if (tmp75(tmp76[12])(closure_2)) {
2026-08-24 06:08:38 +00:00
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);
2026-07-29 08:29:29 +00:00
}
c3 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} else {
const obj4 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj4[0] = closure_1_6.INVALID_PERMISSIONS;
const tmp32 = new closure_1_1(id[11])(obj4, "Invalid Permissions.");
2026-07-29 08:29:29 +00:00
throw tmp32;
}
} else {
const obj5 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj5[0] = closure_1_6.INVALID_SOUND;
2026-07-29 08:29:29 +00:00
const tmp22 = new tmp75(tmp76[11])(obj5, "Invalid Sound.");
throw tmp22;
}
}
} catch (tmp56) {
c3 = tmp;
throw tmp56;
}
}
})();
2026-07-20 16:05:17 +00:00
};
obj[RPCCommands.PLAY_SOUNDBOARD_SOUND] = obj1;
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/rpc/server/commands/soundboard.tsx");
2026-07-20 16:05:17 +00:00
export default obj;