fix version checking for lower versions

This commit is contained in:
Romain Beaumont 2017-03-12 13:51:07 +01:00
parent a55d2bc42c
commit 1e74dc2c1b
No known key found for this signature in database
GPG Key ID: DB60E388B3BCF286

View File

@ -2,7 +2,9 @@ module.exports = function(client,options) {
client.on("disconnect",message => {
if(!message.reason)
return;
const versionRequired=/Outdated client! Please use (.+)/.exec(JSON.parse(message.reason).text);
const parsed=JSON.parse(message.reason);
const text=parsed.text ? parsed.text : parsed;
const versionRequired=/(?:Outdated client! Please use|Outdated server! I'm still on) (.+)/.exec(text);
if(!versionRequired)
return;
client.emit("error",new Error("This server is version "+versionRequired[1]+