Snake.js
v0.0.5
Published
An Open Source Slither.io Client
Downloads
3
Readme
Rattle Snake
An Open Source Slither.io Client
- [x] Connect to slither.io servers
- [x] Connect via HTTP proxy
- [x] Face position (head towards a location)
- [x] Snake position
- [x] Retrieve Leaderboard data
- [x] Events (eat food, dead, spawned, etc...)
- [x] 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()