1
0
Fork 0

Secure start cmd with User object without lang, add kfet cmd bool return support, fix grammar and update requirements

This commit is contained in:
Ethanell 2019-10-01 08:50:11 +02:00
parent ba8f17c77c
commit d92cd45706
3 changed files with 8 additions and 4 deletions

View file

@ -6,7 +6,7 @@
"setedt_err_res": "Invalid resources ! \u274C\n\u2139Put your resources number or a export url/QR code of your calendar",
"setedt": "EDT set \u2705",
"getedt_err": "No EDT set ! \u274C",
"notif_event": "\uD83D\uDD14A event is coming !\n",
"notif_event": "\uD83D\uDD14An event is coming !\n",
"kfet": "\uD83D\uDD14Your command is ready !",
"kfet_prb": "\u26A0Your command got a problem, go check whats happening",
"kfet_err": "\u274CYour order is not out",

8
bot.py
View file

@ -103,7 +103,8 @@ async def start(message: types.Message):
with dbL:
with shelve.open("edt", writeback=True) as db:
if user_id not in db:
db[user_id] = User(int(user_id), message.from_user.locale.language)
lg = message.from_user.locale.language if message.from_user.locale.language else ""
db[user_id] = User(int(user_id), lg)
user = db[user_id]
await message.reply(lang(user, "welcome"), parse_mode=ParseMode.MARKDOWN)
@ -147,8 +148,9 @@ async def kfet(message: types.Message):
else:
msg = lang(db[user_id], "kfet_list")
cmds = requests.get(KFET_URL).json()
for c in cmds:
msg += markdown.code(c) + " " if cmds[c]["statut"] == "T" else ""
if cmds:
for c in cmds:
msg += markdown.code(c) + " " if cmds[c]["statut"] == "T" else ""
await message.reply(msg, parse_mode=ParseMode.MARKDOWN)

View file

@ -9,8 +9,10 @@ chardet==3.0.4
ics==0.5
idna==2.8
multidict==4.5.2
Pillow==6.1.0
python-dateutil==2.8.0
pytz==2019.2
pyzbar==0.1.8
requests==2.22.0
six==1.12.0
urllib3==1.25.3