diff options
| author | Igor Tolmachov <me@igorek.dev> | 2022-07-09 12:59:06 +0900 |
|---|---|---|
| committer | Igor Tolmachov <me@igorek.dev> | 2022-07-09 12:59:06 +0900 |
| commit | 8e2b19caa5d92ddad8a8e87b6aae724d3198a14b (patch) | |
| tree | 0186c54017430fcbdab14cbfc8a22e4ea68a274d /shared | |
| parent | dd5afe2b16cf6f5acb8f3345617a7aa9d8b01c57 (diff) | |
| download | karpov_ai_bot-8e2b19caa5d92ddad8a8e87b6aae724d3198a14b.tar.gz karpov_ai_bot-8e2b19caa5d92ddad8a8e87b6aae724d3198a14b.zip | |
Фикс бага
Diffstat (limited to 'shared')
| -rw-r--r-- | shared/config.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shared/config.py b/shared/config.py index 4c64220..09ced45 100644 --- a/shared/config.py +++ b/shared/config.py | |||
| @@ -1,11 +1,15 @@ | |||
| 1 | import logging | ||
| 1 | from copy import deepcopy | 2 | from copy import deepcopy |
| 2 | from json import dump, load | 3 | from json import dump, load |
| 3 | from os import environ as env | 4 | from os import environ as env |
| 4 | from os import path | 5 | from os import path |
| 5 | from typing import Any | 6 | from typing import Any |
| 6 | 7 | ||
| 8 | logging.info("Load configs") | ||
| 9 | |||
| 7 | if not path.exists("data/settings.json"): | 10 | if not path.exists("data/settings.json"): |
| 8 | open("data/settings.json", "w").close() | 11 | with open("data/settings.json", "w") as f: |
| 12 | f.write("{}") | ||
| 9 | fields: dict[str, Any] = { | 13 | fields: dict[str, Any] = { |
| 10 | "chances": {}, | 14 | "chances": {}, |
| 11 | } | 15 | } |
| @@ -21,4 +25,4 @@ def save(): | |||
| 21 | 25 | ||
| 22 | # Configs | 26 | # Configs |
| 23 | token = env["TOKEN"] | 27 | token = env["TOKEN"] |
| 24 | chances = settings["chances"] | 28 | chances: dict[str, int] = settings["chances"] |
