mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Fix if carbon api error
This commit is contained in:
parent
4e3e3122fb
commit
174a8e1ac8
1 changed files with 7 additions and 4 deletions
|
|
@ -6,6 +6,7 @@
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
import httpx
|
||||
import json
|
||||
import os
|
||||
import traceback
|
||||
|
|
@ -113,10 +114,12 @@ async def carbon_make(self: Client, ctx: Message):
|
|||
"code": text,
|
||||
"backgroundColor": "#1F816D",
|
||||
}
|
||||
|
||||
response = await http.post(
|
||||
"https://carbon.yasirapi.eu.org/api/cook", json=json_data
|
||||
)
|
||||
try:
|
||||
response = await http.post(
|
||||
"https://carbon.yasirapi.eu.org/api/cook", json=json_data
|
||||
)
|
||||
except httpx.HTTPError as exc:
|
||||
return await ctx.reply_msg(f"HTTP Exception for {exc.request.url} - {exc}")
|
||||
if response.status_code != 200:
|
||||
return await ctx.reply_photo(
|
||||
f"https://http.cat/{response.status_code}",
|
||||
|
|
|
|||
Loading…
Reference in a new issue