From 4ee701b15904f72366f424f4054eab584f85fe99 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Wed, 20 Jan 2021 10:47:37 +0100 Subject: [PATCH] feat(handlers): add startTyping() (#404) * feat(handlers): triggerTypingIndicator function * add period Co-authored-by: Ayyan * startTyping is better Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Co-authored-by: Ayyan Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> --- src/api/handlers/channel.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/api/handlers/channel.ts b/src/api/handlers/channel.ts index f24709d36..118ca4e34 100644 --- a/src/api/handlers/channel.ts +++ b/src/api/handlers/channel.ts @@ -122,6 +122,15 @@ export async function getPins(channelID: string) { return Promise.all(result.map((res) => structures.createMessage(res))); } +/** + * Trigger a typing indicator for the specified channel. Generally bots should **NOT** implement this route. + * However, if a bot is responding to a command and expects the computation to take a few seconds, + * this endpoint may be called to let the user know that the bot is processing their message. + */ +export function startTyping(channelID: string) { + return RequestManager.post(endpoints.CHANNEL_TYPING(channelID)); +} + /** Send a message to the channel. Requires SEND_MESSAGES permission. */ export async function sendMessage( channelID: string,