From 2b3db734dfd0e9a3cbfdd45fd3aa490b82ddaa08 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Sun, 20 Feb 2022 12:42:23 +0000 Subject: [PATCH] feat(thread): v13 add `newlyCreated` to `threadCreate` event (#7481) --- src/client/actions/ThreadCreate.js | 3 ++- typings/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/actions/ThreadCreate.js b/src/client/actions/ThreadCreate.js index f7c36e678720..d2d58599fb43 100644 --- a/src/client/actions/ThreadCreate.js +++ b/src/client/actions/ThreadCreate.js @@ -13,8 +13,9 @@ class ThreadCreateAction extends Action { * 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.THREAD_CREATE, thread); + client.emit(Events.THREAD_CREATE, thread, data.newly_created ?? false); } return { thread }; } diff --git a/typings/index.d.ts b/typings/index.d.ts index d634484aa9f0..59cc3166128c 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -3969,7 +3969,7 @@ export interface ClientEvents extends BaseClientEvents { roleCreate: [role: Role]; roleDelete: [role: Role]; roleUpdate: [oldRole: Role, newRole: Role]; - threadCreate: [thread: ThreadChannel]; + threadCreate: [thread: ThreadChannel, newlyCreated: boolean]; threadDelete: [thread: ThreadChannel]; threadListSync: [threads: Collection]; threadMemberUpdate: [oldMember: ThreadMember, newMember: ThreadMember];