goofy ahh

This commit is contained in:
Christopher Cookman 2023-08-03 13:01:10 -06:00
parent bf55091c9a
commit 2fe7b53a6e
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
2 changed files with 13 additions and 3 deletions

View file

@ -21,7 +21,10 @@ const colors = require("colors");
// Create a new Discord client // Create a new Discord client
const client = new Discord.Client({ const client = new Discord.Client({
intents: ["MessageContent", "GuildMessages", "Guilds", "DirectMessages", "GuildMessages"] intents: ["MessageContent", "GuildMessages", "Guilds", "DirectMessages", "GuildMessages"],
allowedMentions: { // Disable all mentions
parse: []
}
}); });
@ -223,6 +226,7 @@ client.on('messageCreate', async (message) => {
model: sessions[message.channelId].model, model: sessions[message.channelId].model,
messages: sessions[message.channelId].messages messages: sessions[message.channelId].messages
}).then((data) => { }).then((data) => {
console.log(data.status)
output = data.data.choices[0].message; output = data.data.choices[0].message;
output.name = "Bot"; output.name = "Bot";
if (output.content.endsWith("!!!TERM1234!!!")) { // This can allow a self-termination command if (output.content.endsWith("!!!TERM1234!!!")) { // This can allow a self-termination command
@ -255,10 +259,13 @@ client.on('messageCreate', async (message) => {
return message.channel.send(lang.timeout) return message.channel.send(lang.timeout)
}, config.openai.resetTime); }, config.openai.resetTime);
}).catch((err) => { }).catch((err) => {
clearInterval(typing);
sessions[message.channelId].processing = false;
console.log(`${colors.red("[ERROR]")} An error occured: ${colors.red(err.response.status)}`);
return message.channel.send({ return message.channel.send({
"embeds": [{ "embeds": [{
"title": "Error", "title": "Error",
"description": err, "description": `${lang.errors[err.response.status]}`,
"color": 0xFF0000 "color": 0xFF0000
}] }]
}) })

View file

@ -19,5 +19,8 @@
}] }]
}, },
"busy": "The bot is busy right now. Please try again later.", "busy": "The bot is busy right now. Please try again later.",
"noauth": "This is not an authorized channel." "noauth": "This is not an authorized channel.",
"errors": {
"429": "The bot has reached the $25 OpenAI limit for this month. Go bug <@289884287765839882> and maybe he'll raise the limit."
}
} }