From e4450c8417624b71d779cb4f41692538f9165e10 Mon Sep 17 00:00:00 2001 From: sowgro Date: Sat, 2 Sep 2023 19:12:47 -0400 Subject: first commit --- .../discord.js/src/client/actions/ThreadCreate.js | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 node_modules/discord.js/src/client/actions/ThreadCreate.js (limited to 'node_modules/discord.js/src/client/actions/ThreadCreate.js') 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; -- cgit v1.2.3