destruc7i0n / shulker

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

Discord messages not in minecraft anymore #62

Open renshi2 opened 4 years ago

renshi2 commented 4 years ago

At first, everything with the bot worked (both messages from discord to minecraft and from minecraft to discord). But all of a sudden the messages from discord to minecraft stopped working. (At first it displayed an error message (didn't save the name... Every time a message in discord was send, it'd say something in the terminal about Discord and the Webhook.) Now it doesn't show an error anymore, but still doesn't work... The only things I can imagine that caused this problem are me messing with the latest.log file while the webhook was running and me ones redoing the port forwarding. Any idea what the problem is and how to fix it?

destruc7i0n commented 4 years ago

The messages in MC relies on RCON, which requires a port to use. In the Minecraft log does it mention an RCON connection?

renshi2 commented 4 years ago

Yes, it does mention an rcon connection. I have now also tried re-installing it, but without success

destruc7i0n commented 4 years ago

Can you try a tool like this to see if you are able to connect to the rcon server MC provides? https://bukkit.org/threads/admin-rcon-mcrcon-remote-connection-client-for-minecraft-servers.70910/

Also, have you tried enabling debug mode ("DEBUG": true) in the config.json and saw anything out of the ordinary when sending a message?

Tholleman commented 1 year ago

This may be related to my issue. Minecraft messages can be sent to discord, however sending messages back does not contain the message content, only the user. The command executed is tellraw @a [{"color": "white", "text": "<@test> "}]

I added a small debug line that stringifies the message that is handled and it appears that cleanContent is empty.

This continues to be an issue, even after giving the bot every possible permission.

The full json is {"channelId":"1043838855041777716","guildId":"1043838760934199306","id":"1044557769459650610","createdTimestamp":1669112379184,"type":"DEFAULT","system":false,"content":"","authorId":"_redacted_","pinned":false,"tts":false,"nonce":"1044557768737947648","embeds":[],"components":[],"attachments":[],"stickers":[],"editedTimestamp":null,"webhookId":null,"groupActivityApplicationId":null,"applicationId":null,"activity":null,"flags":0,"reference":null,"interaction":null,"cleanContent":""}

destruc7i0n commented 1 year ago

@Tholleman can you share logs with DEBUG enabled? Thanks for the other debug line as well.

Tholleman commented 1 year ago

Sure! The discord message was sent with the nickname "test" to differentiate it from my minecraft name

$ npm run start

> shulker@3.2.0 start
> node build/index.js

[INFO] Using configuration file: ./config.json
[INFO] Using Discord WebHooks to send messages
[INFO] Using configuration for local log file at "/home/tholleman/minecraft/server/logs/latest.log"
[INFO] Using channel #mc_chat (id: 1043838855041777716) in the server "Test"
[DEBUG] Received [20:54:48] [User Authenticator #1/INFO]: UUID of player tholleman is 38fe7cef-ff34-4d58-a9b1-fadd09eb6348
[DEBUG] Regex could not match the string:
Received: "[20:54:48] [User Authenticator #1/INFO]: UUID of player tholleman is 38fe7cef-ff34-4d58-a9b1-fadd09eb6348", Regex matches lines that start with: "\[Server thread/INFO\]:"
[DEBUG] Received [20:54:49] [Server thread/INFO]: tholleman[/REDACTED] logged in with entity id 41 at (886.6843001351089, -8.0, 1159.6440642896453)
[DEBUG] Received [20:54:49] [Server thread/INFO]: tholleman joined the game
[DEBUG] A player's connection status changed
[DEBUG] Received [20:54:53] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5143ms or 102 ticks behind
[DEBUG] Regex could not match the string:
Received: "[20:54:53] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5143ms or 102 ticks behind", Regex matches lines that start with: "\[Server thread/INFO\]:"
[DEBUG] Received [20:55:18] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 10256ms or 205 ticks behind
[DEBUG] Regex could not match the string:
Received: "[20:55:18] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 10256ms or 205 ticks behind", Regex matches lines that start with: "\[Server thread/INFO\]:"
[DEBUG] Received [20:55:57] [Server thread/INFO]: <tholleman> This does work
[DEBUG] A player sent a chat message
[DEBUG] Username: tholleman
[DEBUG] Text: This does work
[DEBUG] Fetched UUID 38fe7cefff344d58a9b1fadd09eb6348 for username "tholleman"

DISCORD MESSAGE SENT AT THIS POINT

[DEBUG] Building command from "{"channelId":"1043838855041777716","guildId":"1043838760934199306","id":"1044717958833909790","createdTimestamp":1669150571307,"type":"DEFAULT","system":false,"content":"","authorId":"REDACTED","pinned":false,"tts":false,"nonce":"1044717957680201728","embeds":[],"components":[],"attachments":[],"stickers":[],"editedTimestamp":null,"webhookId":null,"groupActivityApplicationId":null,"applicationId":null,"activity":null,"flags":0,"reference":null,"interaction":null,"cleanContent":""}"
[DEBUG] Sending command "tellraw @a [{"color": "white", "text": "<@test> "}]" to the server
[INFO] Authenticated with 127.0.0.1:25575
[DEBUG] Received response: 
[DEBUG] Received [20:56:11] [RCON Listener #2/INFO]: Thread RCON Client /127.0.0.1 started
[DEBUG] Regex could not match the string:
Received: "[20:56:11] [RCON Listener #2/INFO]: Thread RCON Client /127.0.0.1 started", Regex matches lines that start with: "\[Server thread/INFO\]:"
[DEBUG] Received response: 
[DEBUG] Rcon closed!
[DEBUG] Received [20:56:11] [RCON Client /127.0.0.1 #9/INFO]: Thread RCON Client /127.0.0.1 shutting down
[DEBUG] Regex could not match the string:
Received: "[20:56:11] [RCON Client /127.0.0.1 #9/INFO]: Thread RCON Client /127.0.0.1 shutting down", Regex matches lines that start with: "\[Server thread/INFO\]:"

Server log:

[20:53:05] [RCON Listener #2/INFO]: Thread RCON Client /127.0.0.1 started
[20:54:48] [User Authenticator #1/INFO]: UUID of player tholleman is 38fe7cef-ff34-4d58-a9b1-fadd09eb6348
[20:54:49] [Server thread/INFO]: tholleman[/REDACTED] logged in with entity id 41 at (886.6843001351089, -8.0, 1159.6440642896453)
[20:54:49] [Server thread/INFO]: tholleman joined the game
[20:54:53] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5143ms or 102 ticks behind
[20:55:18] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 10256ms or 205 ticks behind
[20:55:57] [Server thread/INFO]: <tholleman> This does work

DISCORD MESSAGE SENT AT THIS POINT

[20:56:11] [RCON Listener #2/INFO]: Thread RCON Client /127.0.0.1 started
[20:56:11] [RCON Client /127.0.0.1 #9/INFO]: Thread RCON Client /127.0.0.1 shutting down
destruc7i0n commented 1 year ago

Hmm this may be from Discord updates recently on pushing towards slash commands... Can you enable message content and guild members in the Discord Developer portal @Tholleman ? image

Tholleman commented 1 year ago

That fixed it, thank you so much! Could you add that to the README.md?