Whisper Bug
- [x] The FAQ doesn't contain a resolution to my issue
Versions
- mineflayer: 4.1.0
- server: purpur 1596 (MC: 1.18.2)
- node: 16.4.0
Detailed description of a problem
When I whispered to the robot, "bot.chat" got a message When whispering with the robot, "bot. Chat" returned a message The returned "message" is correct, but "username" is incorrect
When I send a whisper message to the bot, "username" is "you" When the bot sends me a whisper message, "username" is my game ID Seems "" gets the last character before ":"? But "bot.chat" should not return whisper messages
What did you try yet?
However, i can solve the problem of sending errors to the robot by myself, and add it under bot.chat
if (username === "you") return
But if the ID of a player is "you", that's bad.
Your current code
bot.on('chat', async (username, message) => {
if (username === "you") return
chat(username, message)
})
bot.on('whisper', async (username, message) => {
whisper(username, message)
})
function chat(username, msg) {
console.log(colors('green', '[CHAT] ') + colors('grey', username) + colors('grey', ': ') + msg)
}
function whisper(username, msg) {
console.log(colors('green', '[WHISPER] ') + colors('grey', username) + colors('grey', ': ') + msg)
}
Expected behavior
Whisper message should not be returned in "bot.chat"
the whisper listener only uses regex to intercept the messages, it doesn’t work magic, can you show what the messages look like?
the whisper listener only uses regex to intercept the messages, it doesn’t work magic, can you show what the messages look like?
In "bot.chat"
The error is in the returned username, but the message is normal
When I send a whisper message to the bot, "username" is "you"
When the bot sends me a whisper message, "username" is my game ID
Sorry, my English is not good
You need to provide the message as you see it in game. A screenshot off a whisper message for example.
I think he means this.
that when you whisper someone it says the username as the on to whom you are whispering
but
when you get a whisper from someone the username says 'you'