From e08f2bad30db9e9b35178222d3b8a68570b210e6 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Fri, 31 Mar 2017 12:55:23 +0200 Subject: [PATCH] Add guild#createRole resolve permissions and RoleData optional (#1321) * resolving permissions * make RoleData optional --- src/client/rest/RESTMethods.js | 1 + src/structures/Guild.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index 69f51e699..c00f1bac3 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -418,6 +418,7 @@ class RESTMethods { createGuildRole(guild, data) { if (data.color) data.color = this.client.resolver.resolveColor(data.color); + if (data.permissions) data.permissions = Permissions.resolve(data.permissions); return this.rest.makeRequest('post', Constants.Endpoints.guildRoles(guild.id), true, data).then(role => this.client.actions.GuildRoleCreate.handle({ guild_id: guild.id, diff --git a/src/structures/Guild.js b/src/structures/Guild.js index b837e48c9..3482736fa 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -683,7 +683,7 @@ class Guild { * .then(role => console.log(`Created role ${role}`)) * .catch(console.error) */ - createRole(data) { + createRole(data = {}) { return this.client.rest.methods.createGuildRole(this, data); }