Closed SonicandTailsCD closed 1 year ago
You used bot.chat
before logging in to the server.
Move bot.chat("/skin set SonicandTailsCDb robot1_stevetest")
inside onSpawn
Of course I did. There's a bug with the plugin that I use that respawns you after applying the skin. Or maybe it's intentional, idk! After the bot respawns, it does it again. And it loops. What should I do?
On Mar 23, 2023, at 14:28, 678435021 @.***> wrote:
You used bot.chat before logging in to the server. Move bot.chat("/skin set SonicandTailsCDb robot1_stevetest") inside onSpawn
— Reply to this email directly, view it on GitHubhttps://github.com/PrismarineJS/mineflayer/issues/2988#issuecomment-1481937315, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATDUSLDTBC7H74S3AWMBQQTW5SW6TANCNFSM6AAAAAAWFVZHCM. You are receiving this because you authored the thread.Message ID: @.***>
Oh and me moving that line to onSpawn won't work for me. Anything else I can do?
There's a bug with the plugin that I use that respawns you after applying the skin.
I think it does that to refresh the skin and work properly. I think it's intentional
After the bot respawns, it does it again. And it loops. What should I do?
bot.on('spawn', onSpawn)
will run the onSpawn
function every time the spawn
event gets emitted, not just once, making it loop.
Change bot.on('spawn', onSpawn)
to bot.once('spawn', onSpawn)
to make it trigger only once
Oh and me moving that line to onSpawn won't work for me. Anything else I can do?
It worked for me when I moved it there
Alright. I'm gonna try that… don't close this yet, maybe I still have some other issue. Thanks in advance :)
This worked, the bot spawned correctly. Thanks :)
Versions
Detailed description of a problem
A clear and concise description of what the problem is, with as much context as possible. The bot was joining fine and was working with bot.chat() correctly. Out of nowhere, the bot stops working and throws me off with this error: /Users/adm/Desktop/Bot/node_modules/mineflayer/lib/plugins/chat.js:177 bot._client.chat(smallMsg) ^
TypeError: bot._client.chat is not a function at /Users/adm/Desktop/Bot/node_modules/mineflayer/lib/plugins/chat.js:177:21 at Array.forEach ()
at chatWithHeader (/Users/adm/Desktop/Bot/node_modules/mineflayer/lib/plugins/chat.js:171:25)
at EventEmitter.bot.chat (/Users/adm/Desktop/Bot/node_modules/mineflayer/lib/plugins/chat.js:207:5)
at Object. (/Users/adm/Desktop/Bot/bot2.js:27:5)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
Node.js v17.9.1 What are you building? Simple bot that uses one plugin to load its skin: SkinRestorer What problem are you trying to solve? I need that bot to join
What did you try yet?
Did you try any method from the API?No, I don't even know what that is. Did you try any example? yes Any error from those? yes
Your current code
Expected behavior
A clear and concise description of what you expected to happen. The bot joining and having the skin
Additional context
Add any other context about the problem here. NO. Thanks :)