PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.94k stars 902 forks source link

Commands like /whisper don't work with chat signing #2874

Open Lyh0yh opened 1 year ago

Lyh0yh commented 1 year ago

Is your feature request related to a problem? Please describe.

I need a way to control the bot through private chat.

Describe the solution you'd like

I'm in a multiplayer server If I send a command through /msg id xxx, the robot won't react. But use/minecraft: msg id xxx to respond So I don't think the/msg private chat format of this server is detected Is there any way to let the robot recognize the /msg format of this server?

Describe alternatives you've considered

bot.on('whisper',async (username,message,) => { if(username !== 'RecHnSs')return switch(message){ case'-1': bot.chat('/msg RecHnSs ok') setTimeout(q1,1000) break}}) I don't know why these codes don't wrap(soory)

Additional context

I'm playing a group server, which has many sub-servers. I think this may be the reason why /msg id xxx doesn't respond. The format of private chat received by the server is[Lv.1]RecHnSs messages you: -1

MacaylaMarvelous81 commented 1 year ago

I don't think that the 'whisper' event will be fired by the server's overriden /msg command. You might want to register a chat pattern for this; see this example.

KTibow commented 1 year ago

The code doesn't wrap because you used single backticks. https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks