Skip to content

Commit

Permalink
fix permissions: Value "undefined" is not int for editRole & createRo…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dramex authored and bsian03 committed Oct 10, 2021
1 parent 28b3ba8 commit 8e861cb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,12 @@ class Client extends EventEmitter {
* @returns {Promise<Role>}
*/
createRole(guildID, options, reason) {
if(options.permissions !== undefined) {
options.permissions = options.permissions instanceof Permission ? String(options.permissions.allow) : String(options.permissions);
}
return this.requestHandler.request("POST", Endpoints.GUILD_ROLES(guildID), true, {
name: options.name,
permissions: options.permissions instanceof Permission ? String(options.permissions.allow) : String(options.permissions),
permissions: options.permissions,
color: options.color,
hoist: options.hoist,
mentionable: options.mentionable,
Expand Down Expand Up @@ -1284,7 +1287,9 @@ class Client extends EventEmitter {
*/
editRole(guildID, roleID, options, reason) {
options.reason = reason;
options.permissions = options.permissions instanceof Permission ? String(options.permissions.allow) : String(options.permissions);
if(options.permissions !== undefined) {
options.permissions = options.permissions instanceof Permission ? String(options.permissions.allow) : String(options.permissions);
}
return this.requestHandler.request("PATCH", Endpoints.GUILD_ROLE(guildID, roleID), true, options).then((role) => new Role(role, this.guilds.get(guildID)));
}

Expand Down

0 comments on commit 8e861cb

Please sign in to comment.