From c5a58f3fdc7fa03e6936f3bb34857b54cffc5a5d Mon Sep 17 00:00:00 2001 From: WBHarry Date: Mon, 18 Aug 2025 20:51:17 +0200 Subject: [PATCH] Cleaned up with ui.chat methods --- module/documents/chatMessage.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/documents/chatMessage.mjs b/module/documents/chatMessage.mjs index 8fd41ba6..79449bc0 100644 --- a/module/documents/chatMessage.mjs +++ b/module/documents/chatMessage.mjs @@ -48,9 +48,9 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage { super._onUpdate(changes, options, userId); const lastMessage = Array.from(game.messages).sort((a, b) => b.timestamp - a.timestamp)[0]; - if (lastMessage.id === this.id) { + if (lastMessage.id === this.id && ui.chat.isAtBottom) { setTimeout(() => { - document.querySelector('.chat-scroll').scrollTop = 0x7fffffbf; + ui.chat.scrollBottom(); }, 5); } }