Add exception

This commit is contained in:
Yasir Aris M 2024-08-09 10:43:53 +07:00 committed by GitHub
parent c1f8c45d29
commit 0256ecc517
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -93,6 +93,8 @@ async def gpt4_chatbot(self, ctx: Message, strings):
]
}
response = await fetch.post("https://duckduckgo.com/duckchat/v1/chat", headers=headers, json=data)
if response.status_code != 200:
return await msg.edit_msg(f"ERROR: Status Code {response.status_code}")
messages = []
for line in response.text.splitlines():
if line.startswith('data:'):