From c55041f3bd8d4d885c19356c08c2ea68044be4ed Mon Sep 17 00:00:00 2001 From: Daniel Wykerd Date: Mon, 29 Jun 2020 17:34:31 +0200 Subject: [PATCH] Fix an oopsie --- src/handlers/advanced.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/handlers/advanced.js b/src/handlers/advanced.js index 36b813d..b8af57e 100644 --- a/src/handlers/advanced.js +++ b/src/handlers/advanced.js @@ -244,16 +244,17 @@ const advanced_runner = async (message, ast, args) => { // Discord API const bscript_config = message._server_doc.bscript; let messages_sent = 0; - env.def("get_private_channel", async function (msg) { - if (bscript_config.force_channel_messages) return message.channel; + async function get_priv_chan_intern () { const member = await get_member(message); const channel = await get_user_channel(message, member); member.last_message = new Date(); member.channel_id = channel.id; await member.save(); return channel; - }); + } + env.def("get_private_channel", get_priv_chan_intern); env.def("get_current_channel", async function () { + if (bscript_config.force_channel_messages) return await get_priv_chan_intern(); return message.channel; }); env.def("send_message", async function (msg, channel) {