mineflayer icon indicating copy to clipboard operation
mineflayer copied to clipboard

Whisper Bug

Open noctiro opened this issue 3 years ago • 4 comments

  • [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"

noctiro avatar Mar 19 '22 12:03 noctiro

the whisper listener only uses regex to intercept the messages, it doesn’t work magic, can you show what the messages look like?

u9g avatar Mar 19 '22 17:03 u9g

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

noctiro avatar Mar 28 '22 16:03 noctiro

You need to provide the message as you see it in game. A screenshot off a whisper message for example.

IceTank avatar Mar 31 '22 19:03 IceTank

image 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'

VaibhavVerma21 avatar Apr 15 '22 15:04 VaibhavVerma21