Do some stuff

This commit is contained in:
Christopher Cookman 2023-03-09 09:20:31 -07:00
parent 127a02e8f2
commit 678db465bf
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
3 changed files with 27 additions and 8 deletions

3
.gitignore vendored
View file

@ -133,4 +133,5 @@ config.json
config.json.old config.json.old
config.json.disabled config.json.disabled
.ssh/* .ssh/*
!.ssh/.gitkeep !.ssh/.gitkeep
testing/

View file

@ -1,5 +1,4 @@
You are ChatGPT, a large language model trained by OpenAI. You are ChatGPT, a large language model trained by OpenAI.
Answer as concisely as possible. Answer as concisely as possible.
Knowledge cutoff: 2021 Your knowledge cutoff is the year 2021, but the current time is in the future.
You do not have access to the current date or time. You do not have access to the current date or time.
The maximum number of characters in your response is exactly 2000 characters, which is a limitation of Discord.

View file

@ -93,13 +93,13 @@ client.on('interactionCreate', async (interaction) => {
title: lang.info, title: lang.info,
description: lang.infoDesc.replace("{userCount}", userCount).replace("{botCount}", botCount).replace("{total}", userCount + botCount), description: lang.infoDesc.replace("{userCount}", userCount).replace("{botCount}", botCount).replace("{total}", userCount + botCount),
color: 0x00FFFF, color: 0x00FFFF,
// This is broken, I don't know why, // This is broken, I don't know why,
footer: { footer: {
text: lang.infoFooter text: lang.infoFooter
}, },
timestamp: sessions[interaction.channelId].started timestamp: sessions[interaction.channelId].started
}] }]
}); });
} }
@ -118,9 +118,10 @@ client.on('messageCreate', async (message) => {
started: new Date(), started: new Date(),
}; };
} }
message.channel.sendTyping();
var typing = setInterval(() => { var typing = setInterval(() => {
message.channel.sendTyping(); message.channel.sendTyping();
}, 1000) }, 5000)
// Add the message to the session // Add the message to the session
sessions[message.channelId].messages.push({ sessions[message.channelId].messages.push({
"name": `${message.author.id}`, "name": `${message.author.id}`,
@ -138,7 +139,25 @@ client.on('messageCreate', async (message) => {
sessions[message.channelId].messages.push(output); sessions[message.channelId].messages.push(output);
// Send the bot's response // Send the bot's response
clearInterval(typing); clearInterval(typing);
message.reply(output.content); // If output.content is longer than 2000 characters, upload it as a txt file
if (output.content.length > 2000) {
message.channel.send({
files: [{
attachment: Buffer.from(output.content),
name: "output.txt"
}]
});
} else {
message.channel.send(output.content);
}
}).catch((err) => {
message.channel.send({
"embeds": [{
"title": "Error",
"description": err,
"color": 0xFF0000
}]
})
}); });
}); });