Removed unnecessary folder

If you're cloning from the repo, use "grunt --dev" to generate it
This commit is contained in:
abalabahaha
2015-11-28 10:58:56 -08:00
parent 0d36abd6a3
commit eaf30cc80c
25 changed files with 0 additions and 4569 deletions

View File

@@ -1,39 +0,0 @@
"use strict";
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 _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 Equality = require("../Util/Equality.js");
var Cache = require("../Util/Cache.js");
var PermissionOverwrite = require("./PermissionOverwrite.js");
var reg = require("../Util/ArgumentRegulariser.js").reg;
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, reg(this, arguments));
};
_createClass(Channel, [{
key: "isPrivate",
get: function get() {
return !!this.server;
}
}]);
return Channel;
})(Equality);
module.exports = Channel;

View File

@@ -1,75 +0,0 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Permissions = require("../Constants.js").Permissions;
var ChannelPermissions = (function () {
function ChannelPermissions(permissions) {
_classCallCheck(this, ChannelPermissions);
this.permissions = permissions;
}
ChannelPermissions.prototype.serialise = function serialise(explicit) {
var _this = this;
var hp = function hp(perm) {
return _this.hasPermission(perm, explicit);
};
return {
// general
createInstantInvite: hp(Permissions.createInstantInvite),
kickMembers: hp(Permissions.kickMembers),
banMembers: hp(Permissions.banMembers),
managePermissions: hp(Permissions.managePermissions),
manageChannel: hp(Permissions.manageChannel),
manageServer: hp(Permissions.manageServer),
// text
readMessages: hp(Permissions.readMessages),
sendMessages: hp(Permissions.sendMessages),
sendTTSMessages: hp(Permissions.sendTTSMessages),
manageMessages: hp(Permissions.manageMessages),
embedLinks: hp(Permissions.embedLinks),
attachFiles: hp(Permissions.attachFiles),
readMessageHistory: hp(Permissions.readMessageHistory),
mentionEveryone: hp(Permissions.mentionEveryone),
// voice
voiceConnect: hp(Permissions.voiceConnect),
voiceSpeak: hp(Permissions.voiceSpeak),
voiceMuteMembers: hp(Permissions.voiceMuteMembers),
voiceDeafenMembers: hp(Permissions.voiceDeafenMembers),
voiceMoveMembers: hp(Permissions.voiceMoveMembers),
voiceUseVAD: hp(Permissions.voiceUseVAD)
};
};
ChannelPermissions.prototype.serialize = function serialize() {
// ;n;
return this.serialise();
};
ChannelPermissions.prototype.hasPermission = function hasPermission(perm) {
var explicit = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
if (perm instanceof String || typeof perm === "string") {
perm = Permissions[perm];
}
if (!perm) {
return false;
}
if (!explicit) {
// implicit permissions allowed
if (!!(this.permissions & Permissions.manageRoles)) {
// manageRoles allowed, they have all permissions
return true;
}
}
return !!(this.permissions & perm);
};
return ChannelPermissions;
})();
module.exports = ChannelPermissions;

View File

@@ -1,32 +0,0 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Server = require("./Server.js");
var ServerChannel = require("./ServerChannel.js");
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;
};
return Invite;
})();
module.exports = Invite;

View File

@@ -1,87 +0,0 @@
"use strict";
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 _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 Cache = require("../Util/Cache.js");
var User = require("./User.js");
var reg = require("../Util/ArgumentRegulariser.js").reg;
var Equality = require("../Util/Equality");
var Message = (function (_Equality) {
_inherits(Message, _Equality);
function Message(data, channel, client) {
var _this = this;
_classCallCheck(this, Message);
_Equality.call(this);
this.channel = channel;
this.client = client;
this.nonce = data.nonce;
this.attachments = data.attachments;
this.tts = data.tts;
this.embeds = data.embeds;
this.timestamp = Date.parse(data.timestamp);
this.everyoneMentioned = data.mention_everyone;
this.id = data.id;
if (data.edited_timestamp) this.editedTimestamp = Date.parse(data.edited_timestamp);
if (data.author instanceof User) this.author = data.author;else this.author = client.internal.users.add(new User(data.author, client));
this.content = data.content;
this.mentions = new Cache();
data.mentions.forEach(function (mention) {
// this is .add and not .get because it allows the bot to cache
// users from messages from logs who may have left the server and were
// not previously cached.
if (mention instanceof User) _this.mentions.push(mention);else _this.mentions.add(client.internal.users.add(new User(mention, client)));
});
}
Message.prototype.isMentioned = function isMentioned(user) {
user = this.client.internal.resolver.resolveUser(user);
if (user) {
return this.mentions.has("id", user.id);
} else {
return false;
}
};
Message.prototype.toString = function toString() {
return this.content;
};
Message.prototype["delete"] = function _delete() {
return this.client.deleteMessage.apply(this.client, reg(this, arguments));
};
Message.prototype.update = function update() {
return this.client.updateMessage.apply(this.client, reg(this, arguments));
};
Message.prototype.reply = function reply() {
return this.client.reply.apply(this.client, reg(this, arguments));
};
Message.prototype.replyTTS = function replyTTS() {
return this.client.replyTTS.apply(this.client, reg(this, arguments));
};
_createClass(Message, [{
key: "sender",
get: function get() {
return this.author;
}
}]);
return Message;
})(Equality);
module.exports = Message;

View File

@@ -1,53 +0,0 @@
"use strict";
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 _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 Channel = require("./Channel.js");
var User = require("./User.js");
var Equality = require("../Util/Equality.js");
var Cache = require("../Util/Cache.js");
var reg = require("../Util/ArgumentRegulariser.js").reg;
var PMChannel = (function (_Channel) {
_inherits(PMChannel, _Channel);
function PMChannel(data, client) {
_classCallCheck(this, PMChannel);
_Channel.call(this, data, client);
this.type = data.type || "text";
this.lastMessageId = data.last_message_id;
this.messages = new Cache("id", 1000);
this.recipient = this.client.internal.users.add(new User(data.recipient, this.client));
}
/* warning! may return null */
PMChannel.prototype.toString = function toString() {
return this.recipient.toString();
};
PMChannel.prototype.sendMessage = function sendMessage() {
return this.client.sendMessage.apply(this.client, reg(this, arguments));
};
PMChannel.prototype.sendTTSMessage = function sendTTSMessage() {
return this.client.sendTTSMessage.apply(this.client, reg(this, arguments));
};
_createClass(PMChannel, [{
key: "lastMessage",
get: function get() {
return this.messages.get("id", this.lastMessageID);
}
}]);
return PMChannel;
})(Channel);
module.exports = PMChannel;

View File

@@ -1,86 +0,0 @@
"use strict";
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Permissions = require("../Constants.js").Permissions;
var PermissionOverwrite = (function () {
function PermissionOverwrite(data) {
_classCallCheck(this, PermissionOverwrite);
this.id = data.id;
this.type = data.type; // member or role
this.deny = data.deny;
this.allow = data.allow;
}
// returns an array of allowed permissions
PermissionOverwrite.prototype.setAllowed = function setAllowed(allowedArray) {
var _this = this;
allowedArray.forEach(function (permission) {
if (permission instanceof String || typeof permission === "string") {
permission = Permissions[permission];
}
if (permission) {
_this.allow |= 1 << permission;
}
});
};
PermissionOverwrite.prototype.setDenied = function setDenied(deniedArray) {
var _this2 = this;
deniedArray.forEach(function (permission) {
if (permission instanceof String || typeof permission === "string") {
permission = Permissions[permission];
}
if (permission) {
_this2.deny |= 1 << permission;
}
});
};
_createClass(PermissionOverwrite, [{
key: "allowed",
get: function get() {
var allowed = [];
for (var permName in Permissions) {
if (permName === "manageRoles" || permName === "manageChannels") {
// these permissions do not exist in overwrites.
continue;
}
if (!!(this.allow & Permissions[permName])) {
allowed.push(permName);
}
}
return allowed;
}
// returns an array of denied permissions
}, {
key: "denied",
get: function get() {
var denied = [];
for (var permName in Permissions) {
if (permName === "manageRoles" || permName === "manageChannels") {
// these permissions do not exist in overwrites.
continue;
}
if (!!(this.deny & Permissions[permName])) {
denied.push(permName);
}
}
return denied;
}
}]);
return PermissionOverwrite;
})();
module.exports = PermissionOverwrite;

View File

@@ -1,139 +0,0 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Permissions = require("../Constants.js").Permissions;
/*
example data
{ position: -1,
permissions: 36953089,
name: '@everyone',
managed: false,
id: '110007368451915776',
hoist: false,
color: 0 }
*/
var DefaultRole = [Permissions.createInstantInvite, Permissions.readMessages, Permissions.readMessageHistory, Permissions.sendMessages, Permissions.sendTTSMessages, Permissions.embedLinks, Permissions.attachFiles, Permissions.readMessageHistory, Permissions.mentionEveryone, Permissions.voiceConnect, Permissions.voiceSpeak, Permissions.voiceUseVAD].reduce(function (previous, current) {
return previous | current;
}, 0);
var Role = (function () {
function Role(data, server, client) {
_classCallCheck(this, Role);
this.position = data.position || -1;
this.permissions = data.permissions || (data.name === "@everyone" ? DefaultRole : 0);
this.name = data.name || "@everyone";
this.managed = data.managed || false;
this.id = data.id;
this.hoist = data.hoist || false;
this.color = data.color || 0;
this.server = server;
this.client = client;
}
Role.prototype.serialise = function serialise(explicit) {
var _this = this;
var hp = function hp(perm) {
return _this.hasPermission(perm, explicit);
};
return {
// general
createInstantInvite: hp(Permissions.createInstantInvite),
kickMembers: hp(Permissions.kickMembers),
banMembers: hp(Permissions.banMembers),
manageRoles: hp(Permissions.manageRoles),
manageChannels: hp(Permissions.manageChannels),
manageServer: hp(Permissions.manageServer),
// text
readMessages: hp(Permissions.readMessages),
sendMessages: hp(Permissions.sendMessages),
sendTTSMessages: hp(Permissions.sendTTSMessages),
manageMessages: hp(Permissions.manageMessages),
embedLinks: hp(Permissions.embedLinks),
attachFiles: hp(Permissions.attachFiles),
readMessageHistory: hp(Permissions.readMessageHistory),
mentionEveryone: hp(Permissions.mentionEveryone),
// voice
voiceConnect: hp(Permissions.voiceConnect),
voiceSpeak: hp(Permissions.voiceSpeak),
voiceMuteMembers: hp(Permissions.voiceMuteMembers),
voiceDeafenMembers: hp(Permissions.voiceDeafenMembers),
voiceMoveMembers: hp(Permissions.voiceMoveMembers),
voiceUseVAD: hp(Permissions.voiceUseVAD)
};
};
Role.prototype.serialize = function serialize() {
// ;n;
return this.serialise();
};
Role.prototype.hasPermission = function hasPermission(perm) {
var explicit = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
if (perm instanceof String || typeof perm === "string") {
perm = Permissions[perm];
}
if (!perm) {
return false;
}
if (!explicit) {
// implicit permissions allowed
if (!!(this.permissions & Permissions.manageRoles)) {
// manageRoles allowed, they have all permissions
return true;
}
}
// e.g.
// !!(36953089 & Permissions.manageRoles) = not allowed to manage roles
// !!(36953089 & (1 << 21)) = voice speak allowed
return !!(this.permissions & perm);
};
Role.prototype.setPermission = function setPermission(permission, value) {
if (permission instanceof String || typeof permission === "string") {
permission = Permissions[permission];
}
if (permission) {
// valid permission
if (value) {
this.permissions |= permission;
} else {
this.permissions &= ~permission;
}
}
};
Role.prototype.setPermissions = function setPermissions(obj) {
var _this2 = this;
obj.forEach(function (value, permission) {
if (permission instanceof String || typeof permission === "string") {
permission = Permissions[permission];
}
if (permission) {
// valid permission
_this2.setPermission(permission, value);
}
});
};
Role.prototype.colorAsHex = function colorAsHex() {
var val = this.color.toString();
while (val.length < 6) {
val = "0" + val;
}
return "#" + val;
};
return Role;
})();
module.exports = Role;

View File

@@ -1,169 +0,0 @@
"use strict";
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 _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 Equality = require("../Util/Equality.js");
var Endpoints = require("../Constants.js").Endpoints;
var Cache = require("../Util/Cache.js");
var User = require("./User.js");
var TextChannel = require("./TextChannel.js");
var VoiceChannel = require("./VoiceChannel.js");
var Role = require("./Role.js");
var strictKeys = ["region", "ownerID", "name", "id", "icon", "afkTimeout", "afkChannelID"];
var Server = (function (_Equality) {
_inherits(Server, _Equality);
function Server(data, client) {
var _this = this;
_classCallCheck(this, Server);
_Equality.call(this);
var self = this;
this.client = client;
this.region = data.region;
this.ownerID = data.owner_id;
this.name = data.name;
this.id = data.id;
this.members = new Cache();
this.channels = new Cache();
this.roles = new Cache();
this.icon = data.icon;
this.afkTimeout = data.afkTimeout;
this.afkChannelID = data.afk_channel_id;
this.memberMap = {};
var self = this;
data.roles.forEach(function (dataRole) {
_this.roles.add(new Role(dataRole, _this, client));
});
data.members.forEach(function (dataUser) {
_this.memberMap[dataUser.user.id] = {
roles: dataUser.roles.map(function (pid) {
return self.roles.get("id", pid);
}),
mute: dataUser.mute,
deaf: dataUser.deaf,
joinedAt: Date.parse(dataUser.joined_at)
};
var user = client.internal.users.add(new User(dataUser.user, client));
_this.members.add(user);
});
data.channels.forEach(function (dataChannel) {
if (dataChannel.type === "text") {
var channel = client.internal.channels.add(new TextChannel(dataChannel, client, _this));
_this.channels.add(channel);
} else {
var channel = client.internal.channels.add(new VoiceChannel(dataChannel, client, _this));
_this.channels.add(channel);
}
});
if (data.presences) {
for (var _iterator = data.presences, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var presence = _ref;
var user = client.internal.users.get("id", presence.user.id);
if (user) {
user.status = presence.status;
user.gameID = presence.game_id;
}
}
}
}
Server.prototype.rolesOfUser = function rolesOfUser(user) {
user = this.client.internal.resolver.resolveUser(user);
if (user) {
return this.memberMap[user.id] ? this.memberMap[user.id].roles : [];
} else {
return null;
}
};
Server.prototype.rolesOf = function rolesOf(user) {
return this.rolesOfUser(user);
};
Server.prototype.toString = function toString() {
return this.name;
};
Server.prototype.equalsStrict = function equalsStrict(obj) {
if (obj instanceof Server) {
for (var _iterator2 = strictKeys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var key = _ref2;
if (obj[key] !== this[key]) {
return false;
}
}
} else {
return false;
}
return true;
};
_createClass(Server, [{
key: "iconURL",
get: function get() {
if (!this.icon) {
return null;
} else {
return Endpoints.SERVER_ICON(this.id, this.icon);
}
}
}, {
key: "afkChannel",
get: function get() {
return this.channels.get("id", this.afkChannelID);
}
}, {
key: "defaultChannel",
get: function get() {
return this.channels.get("id", this.id);
}
}, {
key: "owner",
get: function get() {
return this.members.get("id", this.ownerID);
}
}]);
return Server;
})(Equality);
module.exports = Server;

View File

@@ -1,117 +0,0 @@
"use strict";
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 Channel = require("./Channel.js");
var Cache = require("../Util/Cache.js");
var PermissionOverwrite = require("./PermissionOverwrite.js");
var ChannelPermissions = require("./ChannelPermissions.js");
var reg = require("../Util/ArgumentRegulariser.js").reg;
var ServerChannel = (function (_Channel) {
_inherits(ServerChannel, _Channel);
function ServerChannel(data, client, server) {
var _this = this;
_classCallCheck(this, ServerChannel);
_Channel.call(this, data, client);
this.name = data.name;
this.type = data.type;
this.position = data.position;
this.permissionOverwrites = new Cache();
this.server = server;
data.permission_overwrites.forEach(function (permission) {
_this.permissionOverwrites.add(new PermissionOverwrite(permission));
});
}
ServerChannel.prototype.permissionsOf = function permissionsOf(user) {
user = this.client.internal.resolver.resolveUser(user);
if (user) {
if (this.server.owner.equals(user)) {
return new ChannelPermissions(4294967295);
}
var everyoneRole = this.server.roles.get("name", "@everyone");
var userRoles = [everyoneRole].concat(this.server.rolesOf(user) || []);
var userRolesID = userRoles.map(function (v) {
return v.id;
});
var roleOverwrites = [],
memberOverwrites = [];
this.permissionOverwrites.forEach(function (overwrite) {
if (overwrite.type === "member" && overwrite.id === user.id) {
memberOverwrites.push(overwrite);
} else if (overwrite.type === "role" && overwrite.id in userRolesID) {
roleOverwrites.push(overwrite);
}
});
var permissions = 0;
for (var _iterator = userRoles, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var serverRole = _ref;
permissions |= serverRole.permissions;
}
for (var _iterator2 = roleOverwrites.concat(memberOverwrites), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var overwrite = _ref2;
permissions = permissions & ~overwrite.deny;
permissions = permissions | overwrite.allow;
}
return new ChannelPermissions(permissions);
} else {
return null;
}
};
ServerChannel.prototype.permsOf = function permsOf(user) {
return this.permissionsOf(user);
};
ServerChannel.prototype.mention = function mention() {
return "<#" + this.id + ">";
};
ServerChannel.prototype.toString = function toString() {
return this.mention();
};
ServerChannel.prototype.setName = function setName() {
return this.client.setChannelName.apply(this.client, reg(this, arguments));
};
return ServerChannel;
})(Channel);
module.exports = ServerChannel;

View File

@@ -1,58 +0,0 @@
"use strict";
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 _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 ServerChannel = require("./ServerChannel.js");
var Cache = require("../Util/Cache.js");
var reg = require("../Util/ArgumentRegulariser.js").reg;
var TextChannel = (function (_ServerChannel) {
_inherits(TextChannel, _ServerChannel);
function TextChannel(data, client, server) {
_classCallCheck(this, TextChannel);
_ServerChannel.call(this, data, client, server);
this.topic = data.topic;
this.lastMessageID = data.last_message_id;
this.messages = new Cache("id", client.options.maximumMessages);
}
/* warning! may return null */
TextChannel.prototype.setTopic = function setTopic() {
return this.client.setTopic.apply(this.client, reg(this, arguments));
};
TextChannel.prototype.setNameAndTopic = function setNameAndTopic() {
return this.client.setChannelNameAndTopic.apply(this.client, reg(this, arguments));
};
TextChannel.prototype.update = function update() {
return this.client.updateChannel.apply(this.client, reg(this, arguments));
};
TextChannel.prototype.sendMessage = function sendMessage() {
return this.client.sendMessage.apply(this.client, reg(this, arguments));
};
TextChannel.prototype.sendTTSMessage = function sendTTSMessage() {
return this.client.sendTTSMessage.apply(this.client, reg(this, arguments));
};
_createClass(TextChannel, [{
key: "lastMessage",
get: function get() {
return this.messages.get("id", this.lastMessageID);
}
}]);
return TextChannel;
})(ServerChannel);
module.exports = TextChannel;

View File

@@ -1,62 +0,0 @@
"use strict";
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 _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 Equality = require("../Util/Equality.js");
var Endpoints = require("../Constants.js").Endpoints;
var User = (function (_Equality) {
_inherits(User, _Equality);
function User(data, client) {
_classCallCheck(this, User);
_Equality.call(this);
this.client = client;
this.username = data.username;
this.discriminator = data.discriminator;
this.id = data.id;
this.avatar = data.avatar;
this.status = data.status || "offline";
this.gameID = data.game_id || null;
this.typing = {
since: null,
channel: null
};
}
User.prototype.mention = function mention() {
return "<@" + this.id + ">";
};
User.prototype.toString = function toString() {
return this.mention();
};
User.prototype.equalsStrict = function equalsStrict(obj) {
if (obj instanceof User) return this.id === obj.id && this.username === obj.username && this.discriminator === obj.discriminator && this.avatar === obj.avatar && this.status === obj.status && this.gameID === obj.gameID;else return false;
};
User.prototype.equals = function equals(obj) {
if (obj instanceof User) return this.id === obj.id && this.username === obj.username && this.discriminator === obj.discriminator && this.avatar === obj.avatar;else return false;
};
_createClass(User, [{
key: "avatarURL",
get: function get() {
if (!this.avatar) {
return null;
} else {
return Endpoints.AVATAR(this.id, this.avatar);
}
}
}]);
return User;
})(Equality);
module.exports = User;

View File

@@ -1,21 +0,0 @@
"use strict";
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 ServerChannel = require("./ServerChannel.js");
var VoiceChannel = (function (_ServerChannel) {
_inherits(VoiceChannel, _ServerChannel);
function VoiceChannel(data, client, server) {
_classCallCheck(this, VoiceChannel);
_ServerChannel.call(this, data, client, server);
}
return VoiceChannel;
})(ServerChannel);
module.exports = VoiceChannel;