From f187fd8828efb583e6287f582ce8e9a7bfc8ba05 Mon Sep 17 00:00:00 2001 From: Faf4a <87046111+Faf4a@users.noreply.github.com> Date: Wed, 29 Nov 2023 02:23:57 +0100 Subject: [PATCH] feat($broadCastEval): add error when client shard is not initialised --- src/functions/client/broadcastEval.js | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/functions/client/broadcastEval.js b/src/functions/client/broadcastEval.js index be1b587fa..3bc97572d 100644 --- a/src/functions/client/broadcastEval.js +++ b/src/functions/client/broadcastEval.js @@ -1,18 +1,22 @@ module.exports = async (d) => { - const data = d.util.aoiFunc(d); - if (data.err) return d.error(data.err); + const data = d.util.aoiFunc(d); + if (data.err) return d.error(data.err); - const [func] = data.inside.splits; + const [func] = data.inside.splits; - function evalfunc(client, {func}) { - return eval(func) - } + function evalfunc(client, { func }) { + return eval(func); + } - data.result = await d.client.shard.broadcastEval(evalfunc, {context: {func: func}}); + if (!d.client.shard) return d.aoiError.fnError(d,"custom", {}, "ClientShard Class is Not Initialised"); - data.result = data.result.join(" , "); + data.result = await d.client.shard.broadcastEval(evalfunc, { + context: { func: func }, + }); - return { - code: d.util.setCode(data), - }; -}; \ No newline at end of file + data.result = data.result.join(" , "); + + return { + code: d.util.setCode(data), + }; +};