Fix typing indicator going away on longer prompts
This commit is contained in:
parent
3743c8a486
commit
3b4168aa98
5
index.js
5
index.js
|
@ -84,7 +84,9 @@ client.on('messageCreate', async (message) => {
|
||||||
message.channel.send(lang.timeout)
|
message.channel.send(lang.timeout)
|
||||||
}, config.openai.resetTime);
|
}, config.openai.resetTime);
|
||||||
}
|
}
|
||||||
message.channel.sendTyping();
|
var typing = setInterval(() => {
|
||||||
|
message.channel.sendTyping();
|
||||||
|
}, 1000)
|
||||||
// Add the message to the session
|
// Add the message to the session
|
||||||
sessions[message.channelId].messages.push({
|
sessions[message.channelId].messages.push({
|
||||||
"name": "User",
|
"name": "User",
|
||||||
|
@ -101,6 +103,7 @@ client.on('messageCreate', async (message) => {
|
||||||
// Add the bot's response to the session
|
// Add the bot's response to the session
|
||||||
sessions[message.channelId].messages.push(output);
|
sessions[message.channelId].messages.push(output);
|
||||||
// Send the bot's response
|
// Send the bot's response
|
||||||
|
clearInterval(typing);
|
||||||
message.channel.send(output.content);
|
message.channel.send(output.content);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue