Change password format and add completion messages

This commit is contained in:
Leppunen 2020-12-15 16:42:34 +02:00
parent 6c1479a8fb
commit b4146cfc8c

View file

@ -23,7 +23,7 @@ const sleep = (ms) => {
const createTwitchClient = () => { const createTwitchClient = () => {
return new ChatClient({ return new ChatClient({
username: Config.Username, username: Config.Username,
password: `oauth:${Config.Password}`, password: Config.Password,
rateLimits: 'verifiedBot', rateLimits: 'verifiedBot',
}); });
}; };
@ -64,11 +64,11 @@ const getConnection = () => {
} }
if (statusCode === 401) { if (statusCode === 401) {
return clients[1].say(msg.channelName, 'Authorization token is invalid'); return clients[0].say(msg.channelName, 'Authorization token is invalid');
} }
if (statusCode !== 200) { if (statusCode !== 200) {
return clients[1].say(msg.channelName, 'Unexpected error occurred.'); return clients[0].say(msg.channelName, 'Unexpected error occurred.');
} }
const banArr = body.split('\n'); const banArr = body.split('\n');
@ -84,11 +84,13 @@ const getConnection = () => {
} }
await sleep(Config.DelayPerChunk); await sleep(Config.DelayPerChunk);
} }
clients[0].say(msg.channelName, `List ${listID} ran successfully on channel ${channel || msg.channelName}`);
banChunks = []; banChunks = [];
} else { } else {
for (const entry of banArr) { for (const entry of banArr) {
getConnection().privmsg(channel || msg.channelName, entry); getConnection().privmsg(channel || msg.channelName, entry);
} }
clients[0].say(msg.channelName, `List ${listID} ran successfully on channel ${channel || msg.channelName}`);
} }
} }
}); });