Improved Guild#createChannel, added RoleResolvable and fixed a bit of Emoji stuff (#1754)

* Made creating channels with overwrites nicer
and added ClientDataResolver#resolveRole

* Renamed ChannelPermissionOverwrites to ChannelCreationOverwrites

* Added RoleResolvables everywhere possible

* Fixed Emoji#setName resetting restricted roles and Emoji#equals

Which will lead to emojis not to update when roles are being added removed.
This commit is contained in:
SpaceEEC
2017-08-10 01:22:57 +02:00
committed by Crawl
parent 48b69c6e2f
commit 87cdad332c
5 changed files with 132 additions and 53 deletions

View File

@@ -169,11 +169,13 @@ class Role {
/**
* Compares this role's position to another role's.
* @param {Role} role Role to compare to this one
* @param {RoleResolvable} role Role to compare to this one
* @returns {number} Negative number if the this role's position is lower (other role's is higher),
* positive number if the this one is higher (other's is lower), 0 if equal
*/
comparePositionTo(role) {
role = this.client.resolver.resolveRole(this.guild, role);
if (!role) return Promise.reject(new TypeError('INVALID_TYPE', 'role', 'Role nor a Snowflake'));
return this.constructor.comparePositions(this, role);
}