From 4c55097019e94e60a81b0d50f265895330acbd0e Mon Sep 17 00:00:00 2001 From: Leppunen Date: Tue, 7 Sep 2021 00:11:35 +0300 Subject: [PATCH] Send status messages to correct channel --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index e45937f..78afbad 100644 --- a/index.js +++ b/index.js @@ -59,7 +59,7 @@ const fetchUrlList = async (list) => { return listMetaBody; }; -const runList = async (listData, listID, channel) => { +const runList = async (listData, listID, channel, sourceChannel) => { const banArr = listData.split('\n'); const targetChannel = Config.UseParallelUniverse === true ? channel : `#${channel}`; @@ -88,7 +88,7 @@ const runList = async (listData, listID, channel) => { await Promise.allSettled(promises); - say(Config.Username, `${Config.UseParallelUniverse === true ? '[PU]' : ''} Chunk ${currentChunk}/${chunkCount} of ${listID} executed successfully on channel ${targetChannel}`); + say(sourceChannel, `${Config.UseParallelUniverse === true ? '[PU]' : ''} Chunk ${currentChunk}/${chunkCount} of ${listID} executed successfully on channel ${targetChannel}`); if (currentChunk === chunkCount) { break; @@ -231,27 +231,27 @@ if (!Config.IgnorePNSL) { const channel = args[1]; if (!listID) { - return say(Config.Username, 'No list ID provided!'); + return say(channelName, 'No list ID provided!'); } try { if (channel) { const mods = await listenClient.getMods(`#${channel}`); if (!mods.includes(Config.Username)) { - return say(Config.Username, `I am not a moderator in channel ${channel}!`); + return say(channelName, `I am not a moderator in channel ${channel}!`); } } if (!Config.IgnorePNSL) { const data = await fetchList(listID); - await runList(data.listData, listID, channel || channelName); + await runList(data.listData, listID, channel || channelName, channelName); } else { const data = await fetchUrlList(listID); - await runList(data, listID, channel || channelName); + await runList(data, listID, channel || channelName, channelName); } - say(Config.Username, `${Config.UseParallelUniverse === true ? '[PU]' : ''} List ${listID} executed successfully on channel ${channel || channelName}`); + say(channelName, `${Config.UseParallelUniverse === true ? '[PU]' : ''} List ${listID} executed successfully on channel ${channel || channelName}`); } catch (e) { console.error(e); - return say(Config.Username, `Error Occurred! ${e.message}`); + return say(channelName, `Error Occurred! ${e.message}`); } } });