PDA

View Full Version : intercepting chat messages



jkeller
October 4th, 2025, 15:06
Hi! I'm trying to create an extension (for 5E) that redacts certain text from messages. Specifically, it's for table roll results, but I think any messages would be fine.

I've tried overriding deliverChatMessage. When I roll on a table, that function gets called multiple times (once for the table name, once for each column); that's fine. But it gets called where the roll was made; or at least, that program's console is where I see my trace messages (via print).

I want to treat the message differently (for the DM/host vs the players/clients). In other words, I want the host to see the unredacted messages, but the clients to see the redacted version.

I can't figure out what I should be overriding.

Thanks!

Moon Wizard
October 5th, 2025, 19:15
deliverChatMessage is a built-in core API of FG, so not something you want to override.

You might be able to use this kind of call used by the sound triggers:
ChatManager.registerReceiveMessageCallback(Soundse tManager.handleChatMessage);
and then do whatever you need to do to the data.

Regards,
JPG

jkeller
October 5th, 2025, 20:23
Thanks! I'll try that approach.

jkeller
October 7th, 2025, 19:27
So using registerReceiveMessageCallback is closer. It does get called on both the host and client.

It has access to the chat message, but I don't see anyway to change the message. Is it only pass-by-value, or is there some way I could change the message before it gets displayed? Thanks!

jkeller
October 7th, 2025, 21:32
Ok, so I can return true to disable the message display, and then change the local copy of the message, and send that.

That works - but only for the table name message. The table data is somehow sent/processed separately. It doesn't seem to be part of the rMessage sent to my handler.