Better error for ask
This commit is contained in:
parent
7b4b7b44b4
commit
0969e9065a
1 changed files with 14 additions and 2 deletions
|
@ -54,11 +54,23 @@ export class UserCommand extends Command {
|
|||
const content = blockQuote(`> ${prompt}\n${codeBlock(`${chatCompletion.data.choices[0].message?.content}`)}`);
|
||||
|
||||
if (interactionOrMessage instanceof Message) {
|
||||
return askMessage.edit({ content: content.length <= 2000 ? content : 'Sorry... AI no work good...' });
|
||||
return askMessage.edit({
|
||||
content:
|
||||
content.length < 2000
|
||||
? content
|
||||
: `Oops! Discord only allows messages with 2000 characters or less. The prompt used ${
|
||||
prompt.length
|
||||
} characters and the response took ${content.length - prompt.length}`
|
||||
});
|
||||
}
|
||||
|
||||
return interactionOrMessage.editReply({
|
||||
content: content.length <= 2000 ? content : 'Sorry... AI no work good...'
|
||||
content:
|
||||
content.length < 2000
|
||||
? content
|
||||
: `Oops! Discord only allows messages with 2000 characters or less. The prompt used ${
|
||||
prompt.length
|
||||
} characters and the response took ${content.length - prompt.length}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue