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

151 lines
4.8 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 13651
// Function ID: 13652
2026-07-29 08:29:29 +00:00
// Name: RPC_LOCAL_SCOPE
2026-08-05 07:35:12 +00:00
// Dependencies: [5, 4700, 1874, 4158, 505, 8796, 5847, 4707, 10518, 5882, 5853, 10515, 5884, 5615, 2]
2026-07-23 10:11:24 +00:00
2026-08-05 07:35:12 +00:00
// Module 13651 (RPC_LOCAL_SCOPE)
2026-07-23 10:11:24 +00:00
import set from "set";
2026-07-29 08:29:29 +00:00
import handleSoundCreateOrUpdate from "handleSoundCreateOrUpdate";
import mergeGuildAvatar from "mergeGuildAvatar";
2026-07-23 10:11:24 +00:00
import RPC_SCOPE_CONFIG from "RPC_SCOPE_CONFIG";
import sum from "sum";
2026-07-20 16:05:17 +00:00
let RPCCommands;
2026-07-29 08:29:29 +00:00
let RPC_LOCAL_SCOPE;
let RPC_SCOPE_CONFIG;
2026-07-23 10:11:24 +00:00
let closure_6;
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-04 21:03:28 +00:00
let closure_1 = tmp5;
let sounds2 = tmp2;
const obj2 = outer1_0(table[6]);
yield obj2.maybeFetchSoundboardSounds();
sounds2 = sounds.getSounds();
closure_1 = [];
const item = sounds2.forEach((arr) => arr.forEach((arg0) => arr.push(outer1_0(outer1_2[7]).soundboardSoundToAPI(arg0))));
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-05 07:35:12 +00:00
let obj = importDefault(10518)(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
let importDefault;
let require;
({ 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-05 07:35:12 +00:00
return { value: "T", 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;
const obj1 = { value: null, done: false };
obj1[0] = outer1_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 = outer1_5.getCurrentUser();
sound = outer1_4.getSound(currentUser, sound);
closure_2 = outer1_1(id[9])();
let result = null != sound;
if (result) {
result = null != currentUser;
}
if (result) {
obj = outer1_0(id[10]);
result = obj.canUseSoundboardSound(currentUser, sound, closure_2);
}
c3 = result;
if (null == closure_2) {
let obj3 = { errorCode: null };
obj3[0] = outer1_6.INVALID_CHANNEL;
const tmp52 = new outer1_1(id[11])(obj3, "Invalid Channel.");
throw tmp52;
} else if (c3) {
if (tmp75(tmp76[12])(closure_2)) {
if (null != outer1_1) {
obj3 = outer1_0(id[10]);
const items = [outer1_1(id[13]).RPC];
obj3.playSound(outer1_1, id.id, items);
}
c3 = 3;
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
} else {
const obj4 = { errorCode: null };
obj4[0] = outer1_6.INVALID_PERMISSIONS;
const tmp32 = new outer1_1(id[11])(obj4, "Invalid Permissions.");
throw tmp32;
}
} else {
const obj5 = { errorCode: null };
obj5[0] = outer1_6.INVALID_SOUND;
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-07-29 08:29:29 +00:00
let result = require("mergeGuildAvatar").fileFinishedImporting("modules/rpc/server/commands/soundboard.tsx");
2026-07-20 16:05:17 +00:00
export default obj;