From c1dc22a57c7b38922be9afef4e4823fa8795395f Mon Sep 17 00:00:00 2001 From: lolcat Date: Mon, 9 Dec 2024 23:53:07 -0500 Subject: [PATCH] fix reddit embeds --- client.js | 74 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 64 insertions(+), 10 deletions(-) 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