fix: filter server-specific chat tags (#970)

Co-authored-by: ColumbusLabs <287001685+ColumbusLabs@users.noreply.github.com>
This commit is contained in:
Columbus LabsandColumbusLabs authored and GitHub committed 2026-08-09 21:35:13 +01:00
1 parent c0138c3fe0
commit aa59cd1992
3 files changed
+24 -3

No files matched your search

+2 -2
View File
@@ -3,13 +3,13 @@ import { BaseInstancePlugin } from "@clusterio/host";
import { ChatEvent } from "./messages";
/**
* Removes gps and train tags from messags
* Removes server-specific tags from messages.
*
* @param content - string to strip tags from.
* @returns stripped string.
*/
function removeTags(content: string): string {
return content.replace(/(\[gps=-?\d+,-?\d+\]|\[train=\d+\])/g, "");
return content.replace(/\[(?:gps|special-item|train|train-stop)=\S*?\]/gm, "");
}
export class InstancePlugin extends BaseInstancePlugin {