diff --git a/misskaty/plugins/chatbot_ai.py b/misskaty/plugins/chatbot_ai.py index 4f5bbaf2..5370749e 100644 --- a/misskaty/plugins/chatbot_ai.py +++ b/misskaty/plugins/chatbot_ai.py @@ -31,14 +31,12 @@ async def chatbot(c, m): msg = await kirimPesan(m, "Wait a moment looking for your answer..") try: response = (await http.post("https://api.openai.com/v1/chat/completions", headers=headers, json=json_data)).json() - if err := response["error"]: + if err := response.get("error"): return await editPesan(msg, err["message"]) answer = response["choices"][0]["message"]["content"] await editPesan(msg, answer) except MessageTooLong: answerlink = await post_to_telegraph(False, "MissKaty ChatBot ", answer) await editPesan(msg, f"Question for your answer has exceeded TG text limit, check this link to view.\n\n{answerlink}", disable_web_page_preview=True) - except (MessageNotModified, MessageIdInvalid): - pass except Exception as err: await editPesan(msg, f"Oppss. ERROR: {str(err)}")