mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 16:52:16 +00:00
Add guild#createRole resolve permissions and RoleData optional (#1321)
* resolving permissions * make RoleData optional
This commit is contained in:
parent
f73e6a3e4d
commit
e08f2bad30
2 changed files with 2 additions and 1 deletions
|
|
@ -418,6 +418,7 @@ class RESTMethods {
|
||||||
|
|
||||||
createGuildRole(guild, data) {
|
createGuildRole(guild, data) {
|
||||||
if (data.color) data.color = this.client.resolver.resolveColor(data.color);
|
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 =>
|
return this.rest.makeRequest('post', Constants.Endpoints.guildRoles(guild.id), true, data).then(role =>
|
||||||
this.client.actions.GuildRoleCreate.handle({
|
this.client.actions.GuildRoleCreate.handle({
|
||||||
guild_id: guild.id,
|
guild_id: guild.id,
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,7 @@ class Guild {
|
||||||
* .then(role => console.log(`Created role ${role}`))
|
* .then(role => console.log(`Created role ${role}`))
|
||||||
* .catch(console.error)
|
* .catch(console.error)
|
||||||
*/
|
*/
|
||||||
createRole(data) {
|
createRole(data = {}) {
|
||||||
return this.client.rest.methods.createGuildRole(this, data);
|
return this.client.rest.methods.createGuildRole(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue