Replies: 1 comment
-
You can export a function in the files and pass the bot. // otherModule.js
/**
* @param {import('mineflayer').Bot} bot
*/
module.exports = (bot) => {
// do stuff
} // index.js
const bot = createBot({ /* ... */ })
// Load modules
require('./otherModule.js')(bot) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to split the bot code into different files. For example, the code of walking, fishing, protection, etc. and at the end I import them in the main js file and call them, but how do I pass our bot object. I can't create a new bot because it won't be him anymore.
Beta Was this translation helpful? Give feedback.
All reactions