Files
discord.js/lib/Structures/Channel.js
Amish Shah 8d0fc8e0a6 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.
2015-12-26 18:32:46 +00:00

46 lines
2.1 KiB
JavaScript

"use strict";
exports.__esModule = true;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _UtilEquality = require("../Util/Equality");
var _UtilEquality2 = _interopRequireDefault(_UtilEquality);
var _UtilArgumentRegulariser = require("../Util/ArgumentRegulariser");
var Channel = (function (_Equality) {
_inherits(Channel, _Equality);
function Channel(data, client) {
_classCallCheck(this, Channel);
_Equality.call(this);
this.id = data.id;
this.client = client;
}
Channel.prototype["delete"] = function _delete() {
return this.client.deleteChannel.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
};
_createClass(Channel, [{
key: "isPrivate",
get: function get() {
return !this.server;
}
}]);
return Channel;
})(_UtilEquality2["default"]);
exports["default"] = Channel;
module.exports = exports["default"];