Add index.js
This commit is contained in:
commit
399464f763
1 changed files with 14 additions and 0 deletions
14
index.js
Normal file
14
index.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
const mf = require('mineflayer');
|
||||
|
||||
const bot = mf.createBot({
|
||||
host: process.argv[2],
|
||||
port: parseInt(process.argv[3]),
|
||||
username: "EvalBot"
|
||||
});
|
||||
|
||||
bot.on('chat', (uname, msg, jsonMsg) => {
|
||||
if(msg.startsWith("/eval")) {
|
||||
try { bot.chat(`${eval(`${msg}`.slice("/eval ".length))}`); } catch(err) { bot.chat(`${err}`); };
|
||||
}
|
||||
console.log(msg)
|
||||
});
|
Loading…
Reference in a new issue