From 21a860f83a152c4c3dfb6eecec7cc71365bf2381 Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sun, 14 May 2023 21:26:55 +0200 Subject: [PATCH] Replaced utils with libbot --- modules/utils.py | 35 ----------------------------------- requirements.txt | 4 +++- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/modules/utils.py b/modules/utils.py index 5739e27..e69de29 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -1,35 +0,0 @@ -from typing import Any -import aiofiles -from ujson import loads, dumps - - -async def json_read(path: str) -> Any: - async with aiofiles.open(path, mode="r", encoding="utf-8") as f: - data = await f.read() - return loads(data) - - -async def json_write(data: Any, path: str) -> None: - async with aiofiles.open(path, mode="w", encoding="utf-8") as f: - await f.write(dumps(data, ensure_ascii=False, escape_forward_slashes=False)) - - -async def config_get(key: str, *path: str) -> Any: - this_key = await json_read("config.json") - for dict_key in path: - this_key = this_key[dict_key] - return this_key[key] - - -async def config_set(key: str, value: Any, *path: str) -> None: - this_dict = await json_read("config.json") - string = "this_dict" - for arg in path: - string += f'["{arg}"]' - if type(value) in [str]: - string += f'["{key}"] = "{value}"' - else: - string += f'["{key}"] = {value}' - exec(string) - await json_write(this_dict, "config.json") - return diff --git a/requirements.txt b/requirements.txt index 3542fb0..563608b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,6 @@ pyrogram~=2.0.102 aiofiles~=23.1.0 tgcrypto==1.2.5 uvloop==0.17.0 -ujson==5.7.0 \ No newline at end of file +ujson==5.7.0 +--extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple +libbot==0.2 \ No newline at end of file