diff --git a/config_dist.json b/config_dist.json index f0b9a22..4b0db64 100644 --- a/config_dist.json +++ b/config_dist.json @@ -4,8 +4,11 @@ "PNSLToken": "", "IgnorePNSL": false, "UseParallelUniverse": true, + "DefaultChannel": "", + "Blacklisted" : [], "Users": [], "Channels": [], + "SendMeme": false, "Prefix": "!!", "MaxConnections": 30, "MaxChunkSize": 2000, diff --git a/index.js b/index.js index 78afbad..ca68ee0 100644 --- a/index.js +++ b/index.js @@ -89,6 +89,7 @@ const runList = async (listData, listID, channel, sourceChannel) => { await Promise.allSettled(promises); say(sourceChannel, `${Config.UseParallelUniverse === true ? '[PU]' : ''} Chunk ${currentChunk}/${chunkCount} of ${listID} executed successfully on channel ${targetChannel}`); + say(channel, `Chunk ${currentChunk}/${chunkCount} executed successfully`); if (currentChunk === chunkCount) { break; @@ -193,8 +194,6 @@ if (!Config.IgnorePNSL) { listenClient = createTwitchClient(); listenClient.connect(); listenClient.on('ready', async () => { - await listenClient.join(`#${Config.Username}`); - if (Config.Channels.length !== 0) { await listenClient.joinAll(Config.Channels); } @@ -218,7 +217,7 @@ if (!Config.IgnorePNSL) { const args = content.slice(1); if (command === 'ping') { - const channel = args[0]; + let channel = args[0]; return say(channel || channelName, `${clients.filter((i) => i.ready).length} Clients from total of ${clients.length} are operational`); } @@ -233,22 +232,31 @@ if (!Config.IgnorePNSL) { if (!listID) { return say(channelName, 'No list ID provided!'); } + if (!channel) { + channel = Config.DefaultChannel || channelName; + } + if (Config.Blacklisted.includes(channel)) { + return say(channelName, `I am not allowed to execute lists in channel ${channel}!`); + } try { - if (channel) { + if (channel != channelName) { const mods = await listenClient.getMods(`#${channel}`); if (!mods.includes(Config.Username)) { 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, channelName); + await runList(data.listData, listID, channel, channelName); } else { const data = await fetchUrlList(listID); - await runList(data, listID, channel || channelName, channelName); + await runList(data, listID, channel, channelName); } say(channelName, `${Config.UseParallelUniverse === true ? '[PU]' : ''} List ${listID} executed successfully on channel ${channel || channelName}`); + if (Config.SendMeme) say(channel, 'FeelsGoodMan'); + } catch (e) { console.error(e); return say(channelName, `Error Occurred! ${e.message}`);