summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/client/actions/GuildRoleCreate.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/discord.js/src/client/actions/GuildRoleCreate.js')
-rw-r--r--node_modules/discord.js/src/client/actions/GuildRoleCreate.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/client/actions/GuildRoleCreate.js b/node_modules/discord.js/src/client/actions/GuildRoleCreate.js
new file mode 100644
index 0000000..461443b
--- /dev/null
+++ b/node_modules/discord.js/src/client/actions/GuildRoleCreate.js
@@ -0,0 +1,25 @@
+'use strict';
+
+const Action = require('./Action');
+const Events = require('../../util/Events');
+
+class GuildRoleCreate extends Action {
+ handle(data) {
+ const client = this.client;
+ const guild = client.guilds.cache.get(data.guild_id);
+ let role;
+ if (guild) {
+ const already = guild.roles.cache.has(data.role.id);
+ role = guild.roles._add(data.role);
+ /**
+ * Emitted whenever a role is created.
+ * @event Client#roleCreate
+ * @param {Role} role The role that was created
+ */
+ if (!already) client.emit(Events.GuildRoleCreate, role);
+ }
+ return { role };
+ }
+}
+
+module.exports = GuildRoleCreate;