question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using the bots.forEach option

See original GitHub issue
  • What you want to do (the objective in English): I’m trying to make it so both of my accounts/bots will run /server [realm] at login using bots.forEach.

  • What you tried (the code)

function ready () {
  bots.forEach(bot => {
    bot.on('login', function() {
      bot.chat("/server Atlantes");
      console.log("Succesfully logged in at " + ServerName)
    })
  })
}
  • What happened: They just stood at the hub and doesn’t run any commands.
  • What you expected to happen: I expect the bots to run the /server command at login.

I was using mineflayer 2.7.5 when getting this issue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
rom1504commented, May 3, 2019

Maybe but then put a different timeout value for each bot or they will all still connect at the same time

On Fri, May 3, 2019, 17:51 Kasper Seweryn notifications@github.com wrote:

oh, I haven’t seen that. You’re right. It should be changet to setTimeout.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/803#issuecomment-489263726, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR437V7NVQJRU7ATPEQ3TLPTS6VRANCNFSM4HKWI2DQ .

0reactions
rom1504commented, May 4, 2019

Well this is again a basic programming thing… Look at your condition for when to call ready. It will never be executed because i will only get to credentials.length-1

To debug that kind of thing, you can add some console.log everywhere to check what actually get executed. Or you can use nodejs debugger

Read more comments on GitHub >

github_iconTop Results From Across the Web

php array in foreach loop - Stack Overflow
I considered using an if statement with modulo operator ($i%2=1), but do not know how to cope with the parent array() that defines...
Read more >
How to control conversation flow in Bot Framework Composer
You do that by selecting the + in the authoring canvas then Send a response. Enter - ${dialog. foreach.
Read more >
How to use for loops in Robot Framework and Python
Here we are starting our for loop. We will loop over our @{ROBOTS} list variable, and we are defining a ${robot} local variable,...
Read more >
Bots Can Be More Than Text - Microsoft Bot Framework
For this sample, I'm going to use the C# Microsoft Bot Application template ... Bot.Connector.Action>();. foreach(flavor choice in choices).
Read more >
Foreach Scope | MuleSoft Documentation
The following example illustrates a flow that uses Foreach to add information to each message in a collection. The HTTP connector receives a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found