Fixed Colours again

This commit is contained in:
hydrabolt
2015-10-28 15:09:55 +00:00
parent 674ea664ed
commit 1125d4ae97
4 changed files with 2135 additions and 59 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Color = function Color() {
_classCallCheck(this, Color);
};

View File

@@ -1,48 +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 Permission = (function () {
function Permission(packedPermissions) {
_classCallCheck(this, Permission);
function getBit(x) {
return (this.packed >>> x & 1) === 1;
}
this.packed = packedPermissions;
this.createInstantInvite = getBit(0);
this.banMembers = getBit(1);
this.kickMembers = getBit(2);
this.manageRoles = getBit(3);
this.manageChannels = getBit(4);
this.manageServer = getBit(5);
this.readMessages = getBit(10);
this.sendMessages = getBit(11);
this.sendTTSMessages = getBit(12);
this.manageMessages = getBit(13);
this.embedLinks = getBit(14);
this.attachFiles = getBit(15);
this.readMessageHistory = getBit(16);
this.mentionEveryone = getBit(17);
this.voiceConnect = getBit(20);
this.voiceSpeak = getBit(21);
this.voiceMuteMembers = getBit(22);
this.voiceDeafenMembers = getBit(23);
this.voiceMoveMembers = getBit(24);
this.voiceUseVoiceActivation = getBit(26);
}
_createClass(Permission, [{
key: "getBit",
value: function getBit(x) {
return (this.packed >>> x & 1) === 1;
}
}]);
return Permission;
})();

View File

@@ -28,6 +28,9 @@ exports.toDec = function (data) {
var hextest = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;
var num;
if(!data)
return 0;
if (hextest.test(data)) {
// it's a hex number with a # in front
@@ -45,13 +48,16 @@ exports.toDec = function (data) {
num = parseInt(data.substr(1), 16).toString(10);
} else if (hextest.test("#" + data)) {
// it's a hex number with no # in front
num = parseInt(data, 16).toString(10);
if(data.charAt(0) === "0"){
var tdata = data.split("");
tdata[0] = 1;
data = tdata.join("");
}
num = parseInt(data, 16);
} else {
num = data.toString(10);
}
console.log(num);
return parseInt(num);
}