Cleaned up with ui.chat methods

This commit is contained in:
WBHarry 2025-08-18 20:51:17 +02:00
parent f13fced52d
commit c5a58f3fdc

View file

@ -48,9 +48,9 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
super._onUpdate(changes, options, userId); super._onUpdate(changes, options, userId);
const lastMessage = Array.from(game.messages).sort((a, b) => b.timestamp - a.timestamp)[0]; 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(() => { setTimeout(() => {
document.querySelector('.chat-scroll').scrollTop = 0x7fffffbf; ui.chat.scrollBottom();
}, 5); }, 5);
} }
} }