Idea: Custom scripts
š 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.
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.