add error quips

This commit is contained in:
derpystuff 2023-11-29 19:08:26 +01:00
parent 1927c4a6e8
commit 06037204a9

View file

@ -10,26 +10,36 @@ const { iconPill, stringwrap } = require('../../../labscore/utils/markdown')
const { Permissions } = require("detritus-client/lib/constants"); const { Permissions } = require("detritus-client/lib/constants");
const { getUser } = require('../../../labscore/utils/users'); const { getUser } = require('../../../labscore/utils/users');
const quips = `Crunching the data, one byte at a time... const LOADING_QUIPS = [
Loading the knowledge banks, please wait... "Crunching the data, one byte at a time...",
Assembling the perfect response, just for you... "Loading the knowledge banks, please wait...",
Spinning up the chatbot engines... "Assembling the perfect response, just for you...",
Brewing up a fresh batch of answers... "Spinning up the chatbot engines...",
Analyzing the question, hold on tight... "Brewing up a fresh batch of answers...",
Processing your query, please stand by... "Analyzing the question, hold on tight...",
Loading the neural network... "Processing your query, please stand by...",
Stirring the thoughts, almost there... "Loading the neural network...",
Preparing a witty comeback, just a moment... "Stirring the thoughts, almost there...",
Fueling the brain with information... "Preparing a witty comeback, just a moment...",
Weaving together words, just for you... "Fueling the brain with information...",
Unleashing the intelligence, stand by... "Weaving together words, just for you...",
Stirring the creativity, almost ready... "Unleashing the intelligence, stand by...",
Syncing with the vast knowledge base... "Stirring the creativity, almost ready...",
Igniting the conversational skills... "Syncing with the vast knowledge base...",
Compiling a response, just a few more seconds... "Igniting the conversational skills...",
Charging up the linguistic prowess... "Compiling a response, just a few more seconds...",
Loading the arsenal of clever comebacks... "Charging up the linguistic prowess...",
Infusing the responses with wit and charm...`.split('\n') "Loading the arsenal of clever comebacks...",
"Infusing the responses with wit and charm..."
]
const ERROR_QUIPS = [
"Oops, I've run into a problem. But don't worry, my team is on it and I'll be back to full strength soon.",
"Woah there, I've hit a bump in the road. My creators have been notified and I'll be fixed shortly.",
"Oops, I seem to have hit a snag! My creators are on the case, and I'll be back to normal soon.",
"Sorry, something went wrong. My creators have been notified and I'll be fixed shortly.",
"Uh oh, I've encountered an issue. Rest assured, I have my best people working on the problem."
]
module.exports = { module.exports = {
name: 'clyde', name: 'clyde',
@ -71,7 +81,7 @@ You only have access to a limited number of text chats in this channel. You cann
Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"numeric", month:"long", day:"numeric"})}.` Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"numeric", month:"long", day:"numeric"})}.`
try{ try{
let e = createEmbed("ai", context, quips[Math.floor(Math.random()*quips.length)]) let e = createEmbed("ai", context, LOADING_QUIPS[Math.floor(Math.random()*LOADING_QUIPS.length)])
e.author.iconUrl = STATIC_ICONS.ai_clyde e.author.iconUrl = STATIC_ICONS.ai_clyde
await editOrReply(context, e) await editOrReply(context, e)
@ -92,6 +102,8 @@ Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"n
if(!res.body.output) res.body.output = '[Empty Response]' if(!res.body.output) res.body.output = '[Empty Response]'
guh();
if(res.body.output.length <= 4000) description.push(res.body.output) if(res.body.output.length <= 4000) description.push(res.body.output)
else { else {
files.push({ files.push({
@ -112,6 +124,16 @@ Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"n
}) })
}catch(e){ }catch(e){
console.log(e) console.log(e)
return editOrReply(context, {
embeds:[createEmbed("defaultNoFooter", context, {
author: {
iconUrl: STATIC_ICONS.ai_clyde_idle,
name: stringwrap(args.text, 50)
},
description: ERROR_QUIPS[Math.floor(Math.random()*ERROR_QUIPS.length)]
})]
})
return editOrReply(context, createEmbed("error", context, `Unable to generate text.`)) return editOrReply(context, createEmbed("error", context, `Unable to generate text.`))
} }
} }