Added support for server unavailability

it happened just now RIP discord server </3
This commit is contained in:
hydrabolt
2015-09-27 17:05:17 +01:00
parent 5fa7bace10
commit 223753408c
3 changed files with 20 additions and 0 deletions

View File

@@ -1148,6 +1148,12 @@ var Client = (function () {
var self = this;
var server = this.getServer("id", data.id);
if (data.unavailable) {
self.trigger("unavailable", data);
self.debug("Server ID" + +" has been marked unavailable by Discord. It was not cached.");
return;
}
if (!server) {
server = new Server(data, this);
this.serverCache.push(server);

View File

@@ -1048,6 +1048,12 @@ class Client {
var self = this;
var server = this.getServer("id", data.id);
if(data.unavailable){
self.trigger("unavailable", data);
self.debug("Server ID" + + " has been marked unavailable by Discord. It was not cached.");
return;
}
if (!server) {
server = new Server(data, this);
this.serverCache.push(server);

View File

@@ -30,6 +30,14 @@ mybot.on("message", function (message) {
mybot.on("ready", function () {
console.log("im ready");
});
mybot.on("debug", function(info){
console.log(info);
})
mybot.on("unavailable", function(info){
console.log("warning!", info);
})
function dump(msg) {