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

Chat message parameter is empty in 'chat' and 'whisper' events #3493

Open
mdmanl opened this issue Oct 31, 2024 · 0 comments
Open

Chat message parameter is empty in 'chat' and 'whisper' events #3493

mdmanl opened this issue Oct 31, 2024 · 0 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

@mdmanl
Copy link

mdmanl commented Oct 31, 2024

Versions

  • mineflayer: 4.23.0
  • server: vanilla 1.21.1
  • node: 20.0.0

Detailed description of a problem

When using the bot.on('chat') event, the message parameter is always empty, while the username is correctly captured.

What did you try yet?

I tried logging the parameters in the chat event and sending messages in chat, but the message parameter is consistently empty.

Your current code

const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
  host: 'localhost', // minecraft server ip
  username: 'Bot', // username to join as if auth is `offline`, else a unique identifier for this account. Switch if you want to change accounts
  auth: 'microsoft' // for offline mode servers, you can set this to 'offline'
})

bot.on('chat', (username, message) => {
  if (username === bot.username) return
  bot.chat(message)
})

// Log errors and kick reasons:
bot.on('kicked', console.log)
bot.on('error', console.log)

Expected behaviour

I expected the message parameter to contain the text of the message sent by other players in the chat.

@mdmanl mdmanl 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 Oct 31, 2024
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

1 participant