irc embed fix

This commit is contained in:
lolcat 2024-11-24 17:47:20 -05:00
parent 98b71ac466
commit 1369446721
1 changed files with 25 additions and 6 deletions

View File

@ -586,6 +586,23 @@ function init_irc(){
case "#deekchat":
send(1, "<" + from + "> " + message);
deek.emit(
"message",
{
text: message,
id: -1,
files: [],
mentions: [],
replies: [],
channel: 1
},
{
name: from,
id: -1,
picture: null
}
);
break;
}
});
@ -597,7 +614,7 @@ function init_irc(){
irc_logged_in = false;
irc_debounce = false;
irc_client.disconnect();
//irc_client.disconnect();
setTimeout(function(){
@ -704,22 +721,24 @@ deek.on("message", async function(msg, user){
if(
irc_bridge_enabled &&
irc_logged_in &&
msg.channel === 1
msg.channel === 1 &&
msg.id !== -1
){
var irc_username = user.name.replace(/[^A-Za-z0-9-_]/g, "-");
var limit = 412 - ("RELAYMSG #deekchat " + irc_username + "/Dek").length;
msg.text.split("\n").forEach(function(a){
var limit = 412 - ("RELAYMSG #deekchat " + user.name + "/Dek").length;
for(var i=0; i<a.length; i += limit){
irc_client.send("RELAYMSG", "#deekchat", user.name + "/Dek", a.slice(i, i + limit));
irc_client.send("RELAYMSG", "#deekchat", irc_username + "/Dek", a.slice(i, i + limit));
}
});
for(var i=0; i<msg.files.length; i++){
irc_client.send("RELAYMSG", "#deekchat", user.name + "/Dek", msg.files[i]);
irc_client.send("RELAYMSG", "#deekchat", irc_username + "/Dek", msg.files[i]);
}
}