From f328bbb955ea6c56634291883edd22c598d08c99 Mon Sep 17 00:00:00 2001 From: Pg Biel Date: Thu, 13 Apr 2017 05:03:05 -0300 Subject: [PATCH 1/6] make branch --- src/structures/Emoji.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 7ff2142d1040..5f07faaa4ade 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -120,7 +120,7 @@ class Emoji { * .catch(console.error); */ edit(data) { - return this.client.rest.methods.updateEmoji(this, data); + return this.client.rest.methods.updateEmoji(this, data); // } /** From 1ee7b4f40c5865ac0cdaf058e48f90f6981405cc Mon Sep 17 00:00:00 2001 From: Pg Biel Date: Thu, 13 Apr 2017 05:27:02 -0300 Subject: [PATCH 2/6] stuff --- src/structures/Emoji.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 5f07faaa4ade..84bbe4ecc410 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -120,7 +120,40 @@ class Emoji { * .catch(console.error); */ edit(data) { - return this.client.rest.methods.updateEmoji(this, data); // + return this.client.rest.methods.updateEmoji(this, data); + } + + /** + * Set the name of the emoji + * @param {string} name The new name for the emoji + * @returns {Promise} + */ + setName(name) { + return this.edit({ name }); + } + + /** + * Add a role to the list of roles that can use this emoji + * @param {Role} role The role to add + * @returns {Promise} + */ + addRestrictedRole(role) { + const newRoles = new Collection(this.roles); + newRoles.set(role.id, role); + return this.edit({ roles: newRoles }); + } + + /** + * Add multiple roles to the list of roles that can use this emoji + * @param {Array} roles Roles to add + * @returns {Promise} + */ + addRestrictedRoles(roles) { + const newRoles = new Collection(this.roles); + for (const role of roles) { + if (this.guild.roles.has(role.id)) newRoles.set(role.id, role); + } + return this.edit({ roles: newRoles }); } /** From a3c904f19b704a366bf520a275ace92943cb264e Mon Sep 17 00:00:00 2001 From: Pg Biel Date: Tue, 25 Apr 2017 03:18:36 -0300 Subject: [PATCH 3/6] Consistency & remove role(s) --- src/structures/Emoji.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 84bbe4ecc410..2e5bc79f3679 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -138,9 +138,7 @@ class Emoji { * @returns {Promise} */ addRestrictedRole(role) { - const newRoles = new Collection(this.roles); - newRoles.set(role.id, role); - return this.edit({ roles: newRoles }); + return this.addRestrictedRoles([role]); } /** @@ -156,6 +154,28 @@ class Emoji { return this.edit({ roles: newRoles }); } + /** + * Remove a role from the list of roles that can use this emoji + * @param {Role} role The role to remove + * @returns {Promise} + */ + removeRestrictedRole(role) { + return this.removeRestrictedRoles([role]); + } + + /** + * Remove multiple roles from the list of roles that can use this emoji + * @param {Array} roles Roles to remove + * @returns {Promise} + */ + removeRestrictedRoles(roles) { + const newRoles = new Collection(this.roles); + for (const role of roles) { + if (newRoles.has(role.id)) newRoles.delete(role.id); + } + return newRoles; + } + /** * When concatenated with a string, this automatically returns the emoji mention rather than the object. * @returns {string} From 54fd0bc7830be7e9079d05b99a565d2350349ba9 Mon Sep 17 00:00:00 2001 From: Pg Biel Date: Tue, 25 Apr 2017 15:51:56 -0300 Subject: [PATCH 4/6] kill me --- src/structures/Emoji.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 2e5bc79f3679..91f4643bbe03 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -173,7 +173,7 @@ class Emoji { for (const role of roles) { if (newRoles.has(role.id)) newRoles.delete(role.id); } - return newRoles; + return this.edit({ roles: newRoles }); } /** From 651d1229554b3cf3b73e8c3921f6603758960ebf Mon Sep 17 00:00:00 2001 From: Pg Biel Date: Sat, 29 Apr 2017 23:47:55 -0300 Subject: [PATCH 5/6] Doc changes Requested by Crawl --- src/structures/Emoji.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 91f4643bbe03..952daa917885 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -133,7 +133,7 @@ class Emoji { } /** - * Add a role to the list of roles that can use this emoji + * Add a role to the list of roles that can use this emoji. * @param {Role} role The role to add * @returns {Promise} */ @@ -142,8 +142,8 @@ class Emoji { } /** - * Add multiple roles to the list of roles that can use this emoji - * @param {Array} roles Roles to add + * Add multiple roles to the list of roles that can use this emoji. + * @param {Role[]} roles Roles to add * @returns {Promise} */ addRestrictedRoles(roles) { @@ -155,7 +155,7 @@ class Emoji { } /** - * Remove a role from the list of roles that can use this emoji + * Remove a role from the list of roles that can use this emoji. * @param {Role} role The role to remove * @returns {Promise} */ @@ -164,8 +164,8 @@ class Emoji { } /** - * Remove multiple roles from the list of roles that can use this emoji - * @param {Array} roles Roles to remove + * Remove multiple roles from the list of roles that can use this emoji. + * @param {Role[]} roles Roles to remove * @returns {Promise} */ removeRestrictedRoles(roles) { From df307f1bcad19060c2a45d5f1afa6f35287a2afb Mon Sep 17 00:00:00 2001 From: Pg Biel Date: Sat, 29 Apr 2017 23:49:18 -0300 Subject: [PATCH 6/6] forgot 1 --- src/structures/Emoji.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Emoji.js b/src/structures/Emoji.js index 952daa917885..ae4695ef0673 100644 --- a/src/structures/Emoji.js +++ b/src/structures/Emoji.js @@ -124,7 +124,7 @@ class Emoji { } /** - * Set the name of the emoji + * Set the name of the emoji. * @param {string} name The new name for the emoji * @returns {Promise} */