From 3b4168aa98f38ec72b44af6a36ed9adcbdcd3f89 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Wed, 8 Mar 2023 17:52:31 -0700 Subject: [PATCH] Fix typing indicator going away on longer prompts --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d70eea6..ec243e0 100644 --- a/index.js +++ b/index.js @@ -84,7 +84,9 @@ client.on('messageCreate', async (message) => { message.channel.send(lang.timeout) }, config.openai.resetTime); } - message.channel.sendTyping(); + var typing = setInterval(() => { + message.channel.sendTyping(); + }, 1000) // Add the message to the session sessions[message.channelId].messages.push({ "name": "User", @@ -101,6 +103,7 @@ client.on('messageCreate', async (message) => { // Add the bot's response to the session sessions[message.channelId].messages.push(output); // Send the bot's response + clearInterval(typing); message.channel.send(output.content); }); });