diff --git a/bot/bot_listen.py b/bot/bot_listen.py index d6f3327..d8da1d6 100644 --- a/bot/bot_listen.py +++ b/bot/bot_listen.py @@ -15,10 +15,14 @@ async def handler(event): except InvalidMenuMessageError as e: print(e) return - with open(config.menu_history_file_path, "rw", encoding='utf-8') as f: + + with open(config.menu_history_file_path, "r", encoding='utf-8') as f: menus = json.load(f) - menus[msg.date.strftime("%d-%m-%Y")] = {"courses": courses, - "message": msg.message} + + menus[msg.date.strftime("%d-%m-%Y")] = {"courses": courses, + "message": msg.message} + + with open(config.menu_history_file_path, "w", encoding='utf-8') as f: json.dump(menus, f, ensure_ascii=False, indent=4)