Chat Patches

Chat Patches

2M Downloads

Idea: Custom scripts

LWJENNI opened this issue ยท 1 comments

commented

๐Ÿ“Œ Feature Proposal: Custom Script Support for ChatPatches

Hi!
Iโ€™d like to suggest an idea for the ChatPatches mod โ€” adding support for custom scripts for client-side chat message handling.


๐Ÿ“– Idea:

Introduce support for writing custom JavaScript scripts that can handle client-side events like:

  • Receiving chat messages
  • Displaying boss bars
  • Handling titles
  • Scoreboard updates

This system would allow players to:

  • Automatically remove ads or unwanted messages from the chat
  • Hide boss bars or titles based on conditions
  • Filter messages by keywords
  • Customize how chat messages appear

๐Ÿ“ How It Could Work:

  • Add a "Scripts" section in the mod settings, where players can:

    • Create new scripts (with a custom name)
    • Edit the script code (written in JavaScript)
    • Delete scripts
    • Enable/disable scripts individually
    • Specify the server IP where each script should be active
  • Provide built-in documentation listing the available API methods and events, for example:

    • onChatMessage(callback)
    • getServerIp()
    • event.message
    • event.remove()
    • and others

๐Ÿ“ฆ Example Use Case:

A player could write a script like this:

onChatMessage(function(event) {
    if (getServerIp() === "example.net") {
        if (event.message.includes("advertisement")) {
            event.remove();
        }
    }
});

This would automatically remove any chat message containing the word "advertisement" when connected to "example.net".

Optionally, it could capture the next 5 messages or perform additional actions.


๐Ÿ“Œ Why This Would Be Useful:

  • It gives players a flexible, scriptable way to control their client chat experience.
  • Users could tailor chat behavior to specific servers.
  • Can help block spam, manage boss bars, or automate message formatting.
  • No need to edit mod code โ€” scripts are fully managed through the UI.

Iโ€™m not sure how exactly to implement this yet, but Iโ€™d love to see a feature like this added to ChatPatches.

commented

this is a cool idea!! while it's definitely not in scope at the moment, i think down the road i could look into something like providing native integration with KubeJS to accomplish this.