diff --git a/lib/Color.js b/lib/Color.js new file mode 100644 index 000000000..4b1fef101 --- /dev/null +++ b/lib/Color.js @@ -0,0 +1,7 @@ +"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); +}; \ No newline at end of file diff --git a/lib/ServerPermissions.js b/lib/ServerPermissions.js index fc006c174..0a4a63840 100644 --- a/lib/ServerPermissions.js +++ b/lib/ServerPermissions.js @@ -68,12 +68,6 @@ var ServerPermissions = (function () { }; _createClass(ServerPermissions, [{ - key: "colour", - get: function get() { - // screw the american spelling - return this.color; - } - }, { key: "createInstantInvite", get: function get() { return this.getBit(0); diff --git a/lib/index.js b/lib/index.js index d0edc45cf..a11654b8e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -3,10 +3,12 @@ var request = require("superagent"); var Endpoints = require("./Endpoints.js"); var Client = require("./Client.js"); +var Colors = require("../ref/colours.js"); var Discord = { Endpoints: Endpoints, - Client: Client + Client: Client, + Colors: Colors }; Discord.patchStrings = function () { diff --git a/ref/colours.js b/ref/colours.js new file mode 100644 index 000000000..ce650dad2 --- /dev/null +++ b/ref/colours.js @@ -0,0 +1,27 @@ +/* + credits to izy521 for the colour list] + https://github.com/izy521/discord.io/blob/master/docs/colors.md +*/ +module.exports = { + DEFAULT: 0, + AQUA: 1752220, + GREEN: 3066993, + BLUE: 3447003, + PURPLE: 10181046, + GOLD: 15844367, + ORANGE: 15105570, + RED: 15158332, + GREY: 9807270, + DARKER_GREY: 8359053, + NAVY: 3426654, + DARK_AQUA: 1146986, + DARK_GREEN: 2067276, + DARK_BLUE: 2123412, + DARK_PURPLE: 7419530, + DARK_GOLD: 12745742, + DARK_ORANGE: 11027200, + DARK_RED: 10038562, + DARK_GREY: 9936031, + LIGHT_GREY: 12370112, + DARK_NAVY: 2899536 +} \ No newline at end of file diff --git a/src/ServerPermissions.js b/src/ServerPermissions.js index eb44d1a8e..1da3d2747 100644 --- a/src/ServerPermissions.js +++ b/src/ServerPermissions.js @@ -17,12 +17,7 @@ class ServerPermissions { this.id = data.id; } - - get colour(){ - // screw the american spelling - return this.color; - } - + serialise() { return { createInstantInvite : this.createInstantInvite, diff --git a/src/index.js b/src/index.js index 53d7be58e..6bfd12014 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,12 @@ var request = require("superagent"); var Endpoints = require("./Endpoints.js"); var Client = require("./Client.js"); +var Colors = require("../ref/colours.js"); var Discord = { Endpoints : Endpoints, - Client : Client + Client : Client, + Colors : Colors } Discord.patchStrings = function () { diff --git a/test/bot.1.js b/test/bot.1.js index 4532ab381..e019949ca 100644 --- a/test/bot.1.js +++ b/test/bot.1.js @@ -36,6 +36,7 @@ mybot.on("message", function (message) { setTimeout(() => { permission.manageRoles = true; permission.name="asdfasdf"; + permission.color = Discord.Colors.GREEN; mybot.updateRole(message.channel.server, permission).then((perm) => { mybot.reply(message, JSON.stringify(perm.serialise(), null, 4));