mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Handle timeout while using kbbi api
Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
parent
a7926a189b
commit
2923f3674f
1 changed files with 4 additions and 1 deletions
|
|
@ -193,7 +193,10 @@ async def removebg(_, ctx: Client):
|
|||
async def kbbi_search(_, ctx: Client):
|
||||
if len(ctx.command) == 1:
|
||||
return await ctx.reply_msg("Please add keyword to search definition in kbbi")
|
||||
r = await fetch.get(f"https://yasirapi.eu.org/kbbi?kata={ctx.input}")
|
||||
try:
|
||||
r = await fetch.get(f"https://yasirapi.eu.org/kbbi?kata={ctx.input}")
|
||||
except httpx.HTTPError as e:
|
||||
return await ctx.reply_msg(f"HTTP error occured: {e}")
|
||||
if r.status_code != 200:
|
||||
return await ctx.reply("Maaf, makna kata tersebut tidak ditemukan.")
|
||||
parse = r.json()
|
||||
|
|
|
|||
Loading…
Reference in a new issue