diff --git a/client.js b/client.js index 0554436..aae12c6 100644 --- a/client.js +++ b/client.js @@ -215,6 +215,17 @@ async function send(channel, text, file = null, forcemime = null){ channel = channel.channel; } + if(channel === -1){ + + channel = 1; + }else{ + + if(channel === 1){ + + irc_client.say("#deekchat", text); + } + } + if(file === null){ ws.send(JSON.stringify({ @@ -585,7 +596,7 @@ function init_irc(){ switch(to){ case "#deekchat": - send(1, "<" + from + "> " + message); + send(-1, "<" + from + "> " + message); deek.emit( "message", @@ -607,7 +618,7 @@ function init_irc(){ } }); - irc_client.addListener("error", function(message){ + irc_client.addListener("close", function(message){ console.log("IRC error"); console.log(message); @@ -616,10 +627,7 @@ function init_irc(){ irc_debounce = false; //irc_client.disconnect(); - setTimeout(function(){ - - init_irc(); - }, 2000); + init_irc(); }); } @@ -673,6 +681,19 @@ deek.on("message", async function(msg, user){ return; } + if( + user.id === userid && + irc_bridge_enabled && + msg.channel === 1 && + msg.files.length !== 0 + ){ + + for(var i=0; i