diff --git a/Languages/en.json b/Languages/en.json index e6337bc..6dabd69 100644 --- a/Languages/en.json +++ b/Languages/en.json @@ -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", diff --git a/TelegramEDT/kfet.py b/TelegramEDT/kfet.py index 69727de..bf58089 100644 --- a/TelegramEDT/kfet.py +++ b/TelegramEDT/kfet.py @@ -32,10 +32,14 @@ async def kfet(message: types.Message): msg = lang(user, "kfet_close") else: msg = lang(user, "kfet_list") - cmds = requests.get(KFET_URL).json() - if cmds: - for c in cmds: - msg += markdown.code(c) + " " if cmds[c] == "ok" else "" + 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 "" await message.reply(msg, parse_mode=ParseMode.MARKDOWN, reply_markup=key)