mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
Created ChannelPermissions class
This commit is contained in:
9
lib/ChannelPermissions.js
Normal file
9
lib/ChannelPermissions.js
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var ChannelPermissions = function ChannelPermissions(data) {
|
||||
_classCallCheck(this, ChannelPermissions);
|
||||
};
|
||||
|
||||
module.exports = ChannelPermissions;
|
||||
@@ -4,6 +4,8 @@ var _createClass = (function () { function defineProperties(target, props) { for
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var ChannelPermissions = require("./ChannelPermissions.js");
|
||||
|
||||
var Channel = (function () {
|
||||
function Channel(data, server) {
|
||||
_classCallCheck(this, Channel);
|
||||
@@ -15,7 +17,33 @@ var Channel = (function () {
|
||||
this.id = data.id;
|
||||
this.messages = [];
|
||||
this.roles = [];
|
||||
//this.isPrivate = isPrivate; //not sure about the implementation of this...
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = data.permission_overwrites[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var role = _step.value;
|
||||
|
||||
this.roles.push(new ChannelPermissions());
|
||||
}
|
||||
|
||||
//this.isPrivate = isPrivate; //not sure about the implementation of this...
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator["return"]) {
|
||||
_iterator["return"]();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_createClass(Channel, [{
|
||||
@@ -40,29 +68,29 @@ var Channel = (function () {
|
||||
}, {
|
||||
key: "getMessage",
|
||||
value: function getMessage(key, value) {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = this.messages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var message = _step.value;
|
||||
for (var _iterator2 = this.messages[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var message = _step2.value;
|
||||
|
||||
if (message[key] === value) {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator["return"]) {
|
||||
_iterator["return"]();
|
||||
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
|
||||
_iterator2["return"]();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user