Send status messages to correct channel
This commit is contained in:
parent
6a16a7e07f
commit
4c55097019
1 changed files with 8 additions and 8 deletions
16
index.js
16
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}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue