0.0.5 • Published 9 years ago
Snake.js v0.0.5
Rattle Snake
An Open Source Slither.io Client
- Connect to slither.io servers
- Connect via HTTP proxy
- Face position (head towards a location)
- Snake position
- Retrieve Leaderboard data
- Events (eat food, dead, spawned, etc...)
- Proxy auth, HTTPS, SOCKS
- Determine snake length
- Plugin system
- Track food
- Track snake angles
- Sectors
- ???
Code Example
'use strict'
// ========
// Leaderboard Example
//
// This example will get the top players on the leaderboard then disconnect
//
const Bot = require('Snake.js')
const bot = new Bot({
name: process.env.SLITHER_SERVER_NAME || 'Snake.js',
// logLevel: 'debug',
server: process.env.SLITHER_SERVER || '199.21.79.246:444'
})
// Just listen for the leaderboard event then disconnect
bot.once('leaderboard', function(leaderboard) {
console.log()
console.log('====== TOP ' + leaderboard.length + ' ======')
console.log()
leaderboard.forEach(function(entry, i) {
console.log('#' + i + '. ' + entry.name)
})
bot.close()
})
// Print any errors
bot.on('error', function(error) {
console.log('Error: ' + error)
})
// Connect the bot
bot.connect()