Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad parsing of message #3316

Open
1 task done
3jq opened this issue Feb 27, 2024 · 3 comments
Open
1 task done

bad parsing of message #3316

3jq opened this issue Feb 27, 2024 · 3 comments
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@3jq
Copy link

3jq commented Feb 27, 2024

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: 4.20.0
  • server: Paper #.#.#
  • node: v18.17.1

Detailed description of a problem

if you enter a dot in the message either of this happens:

  1. its just that the message owner is not being shown
  2. its being weird (idk how it works..)

What did you try yet?

changing chat.js bot.on('playerChat') code. parsing messages only from .fromNotch method, didnt work

Your current code

        bot.on('chat', async (username, message) => {
            console.log(`USERNAME ${username} MESSAGE ${message}`)
        });

        bot.on('message', (message) => {
            console.log(`ONMESSAGE ${message}`)
        })

        bot.on('messagestr', (message, position, sender, verified) => {
            console.log(`MESSAGESTR ${message}`);
        });

Expected behavior

normally parsed messages

Additional context

Actual in-game chat:
[sleepobot] If it ain't drillable, it's probably flammable.
[sleepooo] Hello
[sleepooo] Hello.
[sleepooo] Hello1.Hello2.Hello3

What's happening in the cmd:
// first message
ONMESSAGE flammable.
MESSAGESTR flammable.

// second message
ONMESSAGE Hello
MESSAGESTR Hello
USERNAME sleepooo MESSAGE Hello

// third message
ONMESSAGE Hello.
MESSAGESTR Hello.

// fourth message
ONMESSAGE Hello1.Hello2.Hello3
MESSAGESTR Hello1.Hello2.Hello3

@3jq 3jq added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Feb 27, 2024
@3jq 3jq changed the title Wrong message specification bad parsing of message Feb 27, 2024
@3jq
Copy link
Author

3jq commented Feb 27, 2024

update: its because of the nochatreports plugin

@3jq
Copy link
Author

3jq commented Feb 29, 2024

More updates:
Here is the configuration of the server, that the issue is present on.
https://github.com/simpvp/config/

@extremeheat
Copy link
Member

This seems intentional, as the server is sending the message as a system message and not a user chat message. The chat event is specifically checking for user chat messages. message and messagestr are the same event but with different parameter arrangements. You should listen to message which will capture both system and user messages and extract the messages out from there.

bot.on('message', function (msg) {
  console.dir(msg, { depth: null })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

2 participants