Add persistent web chat log

This commit is contained in:
Tanner committed 2026-11-14 22:02:08 +00:00
1 parent 9be381c2de
commit 492238aa22
12 files changed
+506 -51

No files matched your search

+5
View File
@@ -10,6 +10,7 @@ from minecraft.networking.types import (
from minecraft.networking.modern import (
ChatCommand, ClientboundPlayerChatPacket, ServerboundChatPacket, SystemChat,
)
from mosfet.chat_log import append_chat_event
class UpdateTimePacket(Packet):
@@ -106,6 +107,8 @@ class ModernChatManager:
)
)
label = '[DM] ' if is_dm else ''
append_chat_event(
self.g, 'dm' if is_dm else 'chat', packet.message, sender_name)
print('[chat] {}{}: {}'.format(label, sender_name, packet.message),
flush=True)
if self.handler:
@@ -140,6 +143,8 @@ class ModernChatManager:
self.g.connection.write_packet(
ChatCommand(command=message[1:]), force=True)
else:
append_chat_event(self.g, 'outgoing', message,
self.g.get('name', 'Mosfet'))
packet = ServerboundChatPacket(
message=message, timestamp=int(time.time() * 1000))
self.g.connection.write_packet(packet, force=True)