diff --git a/commands/misc/chat.js b/commands/misc/chat.js index b2a0701..13484bb 100644 --- a/commands/misc/chat.js +++ b/commands/misc/chat.js @@ -36,7 +36,12 @@ module.exports = { "max_tokens": 250 }) }).then(response => response.json()).then(data => { - answer = data.choices[0].message.content; + if(!data.error) + answer = data.choices[0].message.content; + else{ + console.error(data.error.code); + answer = `Something went wrong. Got error code ${data.error.code}.` + } }).catch(error => { console.error(error); });