auto-sleep for afk #3106
Unanswered
VuHoangQuan2008
asked this question in
Q&A
Replies: 1 comment
-
You can use the time event (https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#time) and then use |
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 made a bot that can sleep when you type "sleep" in the chat but I had a auto-crop farm so I need the bot always sleep when it is night time. Someone please help me, I can't figure this out. Or any solution that the autofarms always work in daytime?
Code:
const mineflayer = require('mineflayer')
const bot = mineflayer.createBot({
host: '192.168.1.xxx',
username: 'YoBot',
auth: 'offline'
})
function createBot () {
bot.once('spawn', () => {
bot.chat("/gamemode creative")
})
bot.on('chat', (username, message) => {
if (username === bot.username) return
switch (message) {
case 'sleep':
goToSleep()
break
case 'wakeup':
wakeUp()
break
}
})
}
createBot()
Beta Was this translation helpful? Give feedback.
All reactions