Clean up Actions code (#591)

This commit is contained in:
Schuyler Cebulskie
2016-09-03 17:48:51 -04:00
committed by Amish Shah
parent 432c5ccc82
commit 59a5862f2d
22 changed files with 71 additions and 98 deletions

View File

@@ -6,17 +6,13 @@ class GuildRoleCreate extends Action {
handle(data) {
const client = this.client;
const guild = client.guilds.get(data.guild_id);
const guild = client.guilds.get(data.guild_id);
if (guild) {
const already = guild.roles.get(data.role.id);
const already = guild.roles.has(data.role.id);
const role = new Role(guild, data.role);
guild.roles.set(role.id, role);
if (!already) {
client.emit(Constants.Events.GUILD_ROLE_CREATE, guild, role);
}
if (!already) client.emit(Constants.Events.GUILD_ROLE_CREATE, guild, role);
return {
role,
};
@@ -28,7 +24,6 @@ class GuildRoleCreate extends Action {
}
}
/**
* Emitted whenever a guild role is created.
*
@@ -37,5 +32,4 @@ class GuildRoleCreate extends Action {
* @param {Role} role the role that was created.
*/
module.exports = GuildRoleCreate;