dahquan / rattlesnake

An Open Source Slither.io Client Framework
MIT License
27 stars 16 forks source link

Is There an event when bot die ? #67

Closed yario-o closed 8 years ago

yario-o commented 8 years ago

Is There an event when bot die ? I Want to do : bot.on('TheEvent', function() {

mayed505 commented 8 years ago

@yario-o i wish there was. so i can reconnect the bots on death.

yario-o commented 8 years ago

The Bots reconnect automatically : const bot = new Bot({ name: process.env.SLITHER_SERVER_NAME || 'www.slither.gg', reconnect: true, // Here the bots reconnect automatically skin: skin, server: server })

mayed505 commented 8 years ago

@yario-o thanks.

yario-o commented 8 years ago

So. There is an event when bot die?

mayed505 commented 8 years ago

@yario-o i dont think so if yes then what will it be for?

devesh457 commented 8 years ago

https://github.com/ClitherProject/Slither.io-Protocol/blob/master/Protocol.md#type_v_detail Check here

yario-o commented 8 years ago

Because the number of bot alive is not perfect. Look : bot.on('disconnect', function() { alive-- print(bot.name + ' died') }) It do alive-- when bot disconnect so when proxy disconnect is do alive--

yario-o commented 8 years ago

@devesh457 Thx

yario-o commented 8 years ago

EDIT : I just find the dead event on the lib now by number of bots alive can't be negative Just replace : bot.on('disconnect', function() { alive-- print(bot.name + ' died') }) To : bot.on('dead', function() { alive-- print(bot.name + ' died') })