diff options
author | destruc7i0n <destruc7i0n@users.noreply.github.com> | 2021-12-29 16:39:46 -0500 |
---|---|---|
committer | destruc7i0n <destruc7i0n@users.noreply.github.com> | 2021-12-29 16:39:46 -0500 |
commit | a04d39a3cbf10e7335889615a36a78827857b566 (patch) | |
tree | ab132aeeb0e931e1131c1a46182a9cb5a7e882e5 /src/MinecraftHandler.ts | |
parent | added config option for watchFile (diff) | |
download | shulker-a04d39a3cbf10e7335889615a36a78827857b566.tar.gz shulker-a04d39a3cbf10e7335889615a36a78827857b566.zip |
escape unicode characters
closes #76
Diffstat (limited to '')
-rw-r--r-- | src/MinecraftHandler.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/MinecraftHandler.ts b/src/MinecraftHandler.ts index bddc515..3353994 100644 --- a/src/MinecraftHandler.ts +++ b/src/MinecraftHandler.ts @@ -3,7 +3,9 @@ import path from 'path' import { Tail } from 'tail' import express from 'express' -import { Config } from './Config' +import type { Config } from './Config' + +import { fixMinecraftUsername } from './lib/util' export type LogLine = { username: string @@ -22,10 +24,6 @@ class MinecraftHandler { this.config = config } - private static fixMinecraftUsername (username: string) { - return username.replace(/(ยง[A-Z-a-z0-9])/g, '') - } - private parseLogLine (data: string): LogLine { const ignored = new RegExp(this.config.REGEX_IGNORED_CHAT) @@ -69,7 +67,7 @@ class MinecraftHandler { return null } - const username = MinecraftHandler.fixMinecraftUsername(matches[1]) + const username = fixMinecraftUsername(matches[1]) const message = matches[2] if (this.config.DEBUG) { console.log('[DEBUG] Username: ' + matches[1]) |