Fix a bug with trying to update IRC channels when IRC is disabled.

merge-requests/20/head
knotteye 4 years ago
parent 4959391034
commit 01e872c552
  1. 10
      src/chat.ts

@ -94,12 +94,14 @@ async function updateUsers() {
async function updateInteg() { async function updateInteg() {
if(liveUsers.length === 0) { if(liveUsers.length === 0) {
chatIntegration = []; chatIntegration = [];
if(config['chat']['irc']['enabled']) updateIRCChan();
if(config['chat']['twitch']['enabled']) updateTwitchChan();
return; return;
} }
if(liveUsers.length === 1) { if(liveUsers.length === 1) {
chatIntegration = await db.query('SELECT * FROM chat_integration WHERE username='+db.raw.escape(liveUsers[0]['username'])); chatIntegration = await db.query('SELECT * FROM chat_integration WHERE username='+db.raw.escape(liveUsers[0]['username']));
updateIRCChan(); if(config['chat']['irc']['enabled']) updateIRCChan();
updateTwitchChan(); if(config['chat']['twitch']['enabled']) updateTwitchChan();
return; return;
} }
var qs: string; var qs: string;
@ -108,8 +110,8 @@ async function updateInteg() {
} }
qs = qs.substring(0, qs.length - 13); qs = qs.substring(0, qs.length - 13);
chatIntegration = await db.query('SELECT * FROM chat_integration WHERE username='+qs); chatIntegration = await db.query('SELECT * FROM chat_integration WHERE username='+qs);
updateIRCChan(); if(config['chat']['irc']['enabled']) updateIRCChan();
updateTwitchChan(); if(config['chat']['twitch']['enabled']) updateTwitchChan();
} }
async function sendAll(user: string, msg: Array<string>, src: string) { async function sendAll(user: string, msg: Array<string>, src: string) {