Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/umrninside/mineflayer-simple-watchdog
Simple watchdog for Mineflayer
https://github.com/umrninside/mineflayer-simple-watchdog
Last synced: about 2 months ago
JSON representation
Simple watchdog for Mineflayer
- Host: GitHub
- URL: https://github.com/umrninside/mineflayer-simple-watchdog
- Owner: UMRnInside
- License: mit
- Created: 2022-02-10T14:01:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-02T10:55:07.000Z (over 2 years ago)
- Last Synced: 2024-10-12T02:07:59.084Z (2 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mineflayer-simple-watchdog
Simple watchdog for Mineflayer## Installtion
`npm install https://github.com/UMRnInside/mineflayer-simple-watchdog`## Example
Kick watchdog when someone chatted
```js
const mineflayer = require('mineflayer');
const simpleWatchdog = require('mineflayer-simple-watchdog');if (process.argv.length < 4 || process.argv.length > 6) {
console.log('Usage : node test.js [] []')
process.exit(1)
}const bot = mineflayer.createBot({
host: process.argv[2],
port: parseInt(process.argv[3]),
username: process.argv[4] ? process.argv[4] : 'watchdog',
password: process.argv[5],
watchdogConfig: {
// default: 30000
timeout: 30000,
// What to do if watchdog timed out? Reset!
// default: bot.quit
resetAction: onTimeout
}
});
bot.loadPlugin(simpleWatchdog);bot.once('spawn', () => {
// watchdog should be started manually
bot.watchdog.start();
});function onTimeout() {
// watchdog stops once bot quits
bot.chat("Oops! Watchdog timed out!");
bot.quit();
}bot.on('chat', (username, message) => {
if (username === bot.username) return;
bot.watchdog.kick();
});
```