summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/client/actions/ThreadCreate.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/discord.js/src/client/actions/ThreadCreate.js')
-rw-r--r--node_modules/discord.js/src/client/actions/ThreadCreate.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/client/actions/ThreadCreate.js b/node_modules/discord.js/src/client/actions/ThreadCreate.js
new file mode 100644
index 0000000..a8ff6c6
--- /dev/null
+++ b/node_modules/discord.js/src/client/actions/ThreadCreate.js
@@ -0,0 +1,24 @@
+'use strict';
+
+const Action = require('./Action');
+const Events = require('../../util/Events');
+
+class ThreadCreateAction extends Action {
+ handle(data) {
+ const client = this.client;
+ const existing = client.channels.cache.has(data.id);
+ const thread = client.channels._add(data);
+ if (!existing && thread) {
+ /**
+ * Emitted whenever a thread is created or when the client user is added to a thread.
+ * @event Client#threadCreate
+ * @param {ThreadChannel} thread The thread that was created
+ * @param {boolean} newlyCreated Whether the thread was newly created
+ */
+ client.emit(Events.ThreadCreate, thread, data.newly_created ?? false);
+ }
+ return { thread };
+ }
+}
+
+module.exports = ThreadCreateAction;