Add some code to stop multiple people asking it things while it's already thinking

This commit is contained in:
Christopher Cookman 2023-03-10 11:19:39 -07:00
parent 4af21dc2e6
commit ec6ad5acf7
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -71,7 +71,7 @@ client.on('interactionCreate', async (interaction) => {
await resetSession(interaction.channelId); await resetSession(interaction.channelId);
interaction.reply(lang.reset); interaction.reply(lang.reset);
} else { } else {
interaction.reply(lang.busy); interaction.reply({content: lang.busy, ephemeral: true});
} }
break; break;
case "info": // Info about the current session case "info": // Info about the current session
@ -134,6 +134,8 @@ client.on('messageCreate', async (message) => {
await clearTimeout(timers[message.channelId]); await clearTimeout(timers[message.channelId]);
delete timers[message.channelId]; delete timers[message.channelId];
} }
// If the session is processing, don't do anything
if (sessions[message.channelId].processing) return message.author.send(lang.busy);
// Set the timer // Set the timer
message.channel.sendTyping(); message.channel.sendTyping();
var typing = setInterval(() => { var typing = setInterval(() => {