destruc7i0n / shulker

A Discord to Vanilla Minecraft Chat Gateway
ISC License
135 stars 47 forks source link

Help with Regex #67

Open sasha-volodin opened 3 years ago

sasha-volodin commented 3 years ago

Hi! Help me pls. Earlier all working: latest.log: [21:39:48] [Async Chat Thread - #65/INFO]: <nickname> msg Regex: "REGEX_MATCH_CHAT_MC": "\\[Async Chat Thread - #\\d*\/INFO\\]: <([^>]*)> (.*)"

But, i change chat cfg: latest.log: [21:36:20] [Async Chat Thread - #64/INFO]: nickname: msg And now msg mc to dc not send. This regex not correct. Help me with regex pls for new chat cfg

sasha-volodin commented 3 years ago

Anybody ?

destruc7i0n commented 3 years ago

Can you send a line from the log enclosed with backticks (``` on both sides) to fix formatting?

sasha-volodin commented 3 years ago

log from mine or ?

destruc7i0n commented 3 years ago

Yeah your log line. In the GitHub editor, when pasting, first click on "Insert Code" in the comment box and then paste the line from your log.

sasha-volodin commented 3 years ago

[22:06:21] [Async Chat Thread - #2/INFO]: sunlight: some msg

destruc7i0n commented 3 years ago

Try this: ^([^:]*): (.*)

sasha-volodin commented 3 years ago

not working (

destruc7i0n commented 3 years ago

Oh I see you're still using REGEX_MATCH_CHAT_MC. I'd recommend updating to the latest version. If you cannot, for REGEX_MATCH_CHAT_MC, the regex would be \[Async Chat Thread - #\d*\/INFO\]: ([^:]*): (.*)

If this doesn't work as well, can you post your full config.json enclosed with the "`" character?

sasha-volodin commented 3 years ago

Doesn't work. Config: ` "PORT": 8000,

"USE_WEBHOOKS": true,
"WEBHOOK_URL": "",
"DISCORD_TOKEN": "",
"DISCORD_CHANNEL_ID": "",
"DISCORD_MESSAGE_TEMPLATE": "`%username%`: %message%",

"MINECRAFT_SERVER_RCON_IP": "127.0.0.1",
"MINECRAFT_SERVER_RCON_PORT": 25575,
"MINECRAFT_SERVER_RCON_PASSWORD": "",
"MINECRAFT_TELLRAW_TEMPLATE": "[{\"color\": \"white\", \"text\": \"<%username%> %message%\"}]",

"IS_LOCAL_FILE": true,
"LOCAL_FILE_PATH": "/home/server/logs/latest.log",

"ALLOW_USER_MENTIONS": false,

"WEBHOOK": "/minecraft/hook",
"REGEX_MATCH_CHAT_MC": "\\[Async Chat Thread - #\\d*\/INFO\\]: <([^>]*)> (.*)",
 "REGEX_IGNORED_CHAT": "packets too frequently",
"RCON_RECONNECT_DELAY": 10,
"DEBUG": false`
destruc7i0n commented 3 years ago
"REGEX_MATCH_CHAT_MC": "\\[Async Chat Thread - #\\d*\/INFO\\]: ([^:]*): (.*)",

This line should work based on the string you sent from my local testing, are you getting any other errors?