mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
Add guild#createRole resolve permissions and RoleData optional (#1321)
* resolving permissions * make RoleData optional
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user