1
0
Fork 0

Look like I don't know how to write code, fix functions name and kfet isoweekday test

This commit is contained in:
Ethanell 2019-09-20 12:03:11 +00:00
parent d2dcfa5824
commit 098a5b0210

8
bot.py
View file

@ -106,7 +106,7 @@ async def start(message: types.Message):
@dp.message_handler(commands="help") @dp.message_handler(commands="help")
async def send_welcome(message: types.Message): async def help_cmd(message: types.Message):
await message.chat.do(types.ChatActions.TYPING) await message.chat.do(types.ChatActions.TYPING)
logger.info(f"{message.from_user.username} do help command: {message.text}") logger.info(f"{message.from_user.username} do help command: {message.text}")
with dbL: with dbL:
@ -133,13 +133,13 @@ async def edt_cmd(message: types.Message):
@dp.message_handler(commands="kfet") @dp.message_handler(commands="kfet")
async def edt_cmd(message: types.Message): async def kfet(message: types.Message):
user_id = str(message.from_user.id) user_id = str(message.from_user.id)
await message.chat.do(types.ChatActions.TYPING) await message.chat.do(types.ChatActions.TYPING)
logger.info(f"{message.from_user.username} do kfet command: {message.text}") logger.info(f"{message.from_user.username} do kfet command: {message.text}")
with dbL: with dbL:
with shelve.open("edt", writeback=True) as db: with shelve.open("edt", writeback=True) as db:
if not 9 < get_now().hour < 14 or not get_now().isoweekday() < 5: if not 9 < get_now().hour < 14 or not get_now().isoweekday() < 6:
msg = lang(db[user_id], "kfet_close") msg = lang(db[user_id], "kfet_close")
else: else:
msg = lang(db[user_id], "kfet_list") msg = lang(db[user_id], "kfet_list")
@ -150,7 +150,7 @@ async def edt_cmd(message: types.Message):
@dp.message_handler(commands="setkfet") @dp.message_handler(commands="setkfet")
async def edt_cmd(message: types.Message): async def kfet_set(message: types.Message):
user_id = str(message.from_user.id) user_id = str(message.from_user.id)
await message.chat.do(types.ChatActions.TYPING) await message.chat.do(types.ChatActions.TYPING)
logger.info(f"{message.from_user.username} do setkfet command: {message.text}") logger.info(f"{message.from_user.username} do setkfet command: {message.text}")