1
0
Fork 0

Error when kfet is down

This commit is contained in:
Ethanell 2019-12-27 13:53:14 +01:00
parent 75d661744a
commit aec7b7043a
2 changed files with 9 additions and 4 deletions

View file

@ -9,6 +9,7 @@
"setedt_wait": "Send a QR code, resource number or the url of the calendar !",
"notif_event": "\uD83D\uDD14An event is coming !\n",
"kfet": "\uD83D\uDD14Your command is ready !",
"kfet_error": "Cant connect to server !",
"kfet_prb": "\u26A0Your command got a problem, go check whats happening",
"kfet_err": "\u274CYour order is not out",
"kfet_list": "\uD83D\uDDD2Kfet commands ready:\n",

View file

@ -32,7 +32,11 @@ async def kfet(message: types.Message):
msg = lang(user, "kfet_close")
else:
msg = lang(user, "kfet_list")
try:
cmds = requests.get(KFET_URL).json()
except (requests.exceptions.ConnectionError, requests.exceptions.ConnectTimeout):
msg = markdown.bold(lang(user, "kfet_error"))
else:
if cmds:
for c in cmds:
msg += markdown.code(c) + " " if cmds[c] == "ok" else ""