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

bot.chat() isn't operational #2885

Closed
1 task done
DominionDev opened this issue Jan 1, 2023 · 3 comments
Closed
1 task done

bot.chat() isn't operational #2885

DominionDev opened this issue Jan 1, 2023 · 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

@DominionDev
Copy link

DominionDev commented Jan 1, 2023

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

Versions

  • mineflayer: 4.6.0
  • server: paper FireFall, idk the version
  • node: 14.16.0

Detailed description of a problem

I'm pretty new to JavaScript, so I have barely any knowledge about it, I'm way more confident in Java.
I tried to create a bot for Minecraft running on 1.19.2 which is possible since the last build, but unfortunately it seems like sending messages doesn't work in this version yet.

What did you try yet?

I really don't have an idea how to address the issue, that's why I create this issue.

I get this error:

TypeError: Serialization error for play.toServer : SizeOf error for undefined : Cannot read property 'length' of undefined
    at Object.previousMessages (eval at compile (D:\JavaScript\node_modules\protodef\src\compiler.js:258:12), <anonymous>:175:37)
    at Object.packet_chat_command (eval at compile (D:\JavaScript\node_modules\protodef\src\compiler.js:258:12), <anonymous>:559:37)
    at eval (eval at compile (D:\JavaScript\node_modules\protodef\src\compiler.js:258:12), <anonymous>:1186:64)
    at packet (eval at compile (D:\JavaScript\node_modules\protodef\src\compiler.js:258:12), <anonymous>:1235:9)
    at CompiledProtodef.sizeOf (D:\JavaScript\node_modules\protodef\src\compiler.js:89:14)
    at e.message (D:\JavaScript\node_modules\protodef\src\compiler.js:96:40)
    at tryCatch (D:\JavaScript\node_modules\protodef\src\utils.js:50:16)
    at CompiledProtodef.createPacketBuffer (D:\JavaScript\node_modules\protodef\src\compiler.js:96:20)
    at Serializer.createPacketBuffer (D:\JavaScript\node_modules\protodef\src\serializer.js:12:23)
    at Serializer._transform (D:\JavaScript\node_modules\protodef\src\serializer.js:18:18) {
  field: 'play.toServer'
}

Your current code

const mineflayer = require('mineflayer')

const options = {
  host: 'server.address', // Change this to the ip you want.
  port: 25565, // Change this to the port you want.
  username: 'nope',
  password: 'notThisTime',
  auth: 'microsoft',
  version: '1.19.2'
}

let timeToStart = Date.now();

const bot = mineflayer.createBot(options)

bot.once('spawn', () => {
    timeToStart = Date.now() - timeToStart
    console.log('Hello, I\'m '+bot.username+". I have successfully connected to "+options.host+" with version "+options.version+" in "+ timeToStart+"ms")
    bot.acceptResourcePack();

    setTimeout(() => {bot.chat('Hello')}, 15000);
  
  })

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

    console.log(`${username} > ${message}`)
  })

Expected behavior

Joining on the server is working flawless, but it won't send the message "Hello" in the chat.
I only get an error telling me that the serialization went wrong.

Additional context

Add any other context about the problem here.

@DominionDev DominionDev 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 Jan 1, 2023
@frej4189
Copy link
Contributor

frej4189 commented Jan 1, 2023

Mineflayer does not support 1.19.2

@DominionDev
Copy link
Author

Mineflayer does not support 1.19.2

Oh, I thought they added finally the support for 1.19.2 with the most recent update. Before it wasn't even possible to join on servers with 1.19.2, now you can.

@extremeheat
Copy link
Member

I agree there could be a better error message here. But dupe of #2797

@extremeheat extremeheat closed this as not planned Won't fix, can't repro, duplicate, stale Jan 1, 2023
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

3 participants