Ubivectel,
пробуй ...
let scroll = true;
if (this.order == "bottom") {
scroll = this.attr("KIDE_msgs", "scrollTop") > (this.attr("KIDE_msgs", "scrollHeight") - this.attr("KIDE_msgs", "clientHeight"));
this.insertAfter(nodo, insertO.lastChild);
} else insertO.insertBefore(nodo, insertO.firstChild);
if (!yo && this.sound == 1) this.play_msg_sound();
if(scroll) this.ajustar_scroll();