mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Clean up Actions code (#591)
This commit is contained in:
committed by
Amish Shah
parent
432c5ccc82
commit
59a5862f2d
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user