Resilience to abusers of the API

For some reason there's a way to join text channels via the Discord API but not the Discord Client, so this commit
prevents the Client from crashing by checking to see if the channels are voice channels.
This commit is contained in:
Amish Shah
2015-12-26 18:32:46 +00:00
parent f9f7a568fc
commit 8d0fc8e0a6
27 changed files with 5052 additions and 241 deletions

View File

@@ -1 +1,40 @@
"use strict";exports.__esModule = true;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var Invite=(function(){function Invite(data,chan,client){_classCallCheck(this,Invite);this.maxAge = data.max_age;this.code = data.code;this.server = chan.server;this.channel = chan;this.revoked = data.revoked;this.createdAt = Date.parse(data.created_at);this.temporary = data.temporary;this.uses = data.uses;this.maxUses = data.uses;this.inviter = client.internal.users.get("id",data.inviter.id);this.xkcd = data.xkcdpass;}Invite.prototype.toString = function toString(){return "https://discord.gg/" + this.code;};Invite.prototype["delete"] = function _delete(){return this.client.deleteInvite.apply(this.client,reg(this,arguments));};Invite.prototype.join = function join(){return this.client.joinServer.apply(this.client,reg(this,arguments));};return Invite;})();exports["default"] = Invite;module.exports = exports["default"];
"use strict";
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Invite = (function () {
function Invite(data, chan, client) {
_classCallCheck(this, Invite);
this.maxAge = data.max_age;
this.code = data.code;
this.server = chan.server;
this.channel = chan;
this.revoked = data.revoked;
this.createdAt = Date.parse(data.created_at);
this.temporary = data.temporary;
this.uses = data.uses;
this.maxUses = data.uses;
this.inviter = client.internal.users.get("id", data.inviter.id);
this.xkcd = data.xkcdpass;
}
Invite.prototype.toString = function toString() {
return "https://discord.gg/" + this.code;
};
Invite.prototype["delete"] = function _delete() {
return this.client.deleteInvite.apply(this.client, reg(this, arguments));
};
Invite.prototype.join = function join() {
return this.client.joinServer.apply(this.client, reg(this, arguments));
};
return Invite;
})();
exports["default"] = Invite;
module.exports = exports["default"];