mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-03 19:14:51 +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 asyncio
|
||||||
|
import httpx
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
@ -113,10 +114,12 @@ async def carbon_make(self: Client, ctx: Message):
|
||||||
"code": text,
|
"code": text,
|
||||||
"backgroundColor": "#1F816D",
|
"backgroundColor": "#1F816D",
|
||||||
}
|
}
|
||||||
|
try:
|
||||||
response = await http.post(
|
response = await http.post(
|
||||||
"https://carbon.yasirapi.eu.org/api/cook", json=json_data
|
"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:
|
if response.status_code != 200:
|
||||||
return await ctx.reply_photo(
|
return await ctx.reply_photo(
|
||||||
f"https://http.cat/{response.status_code}",
|
f"https://http.cat/{response.status_code}",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue