From 01f8a73dae080f997018f791ece463111fd7649e Mon Sep 17 00:00:00 2001 From: profitroll Date: Fri, 14 Jul 2023 12:36:42 +0200 Subject: [PATCH] WIP: Improvements --- config.json | 76 ++++++++++++++++++++++++++++++++++++++++++++++-- locale/en.json | 10 +++++++ locale/uk.json | 10 +++++++ modules/utils.py | 4 +-- 4 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 locale/en.json create mode 100644 locale/uk.json diff --git a/config.json b/config.json index 688ea35..63b1c76 100644 --- a/config.json +++ b/config.json @@ -1,10 +1,80 @@ { - "owner_id": 0, + "locale": "en", "bot": { + "owner": 0, "api_id": 0, "api_hash": "", "bot_token": "", - "workers": 1 + "scoped_commands": true }, - "use_compiled_page_saver": false + "use_compiled_page_saver": false, + "reports": { + "chat_id": "owner" + }, + "disabled_plugins": [], + "commands": { + "help": { + "scopes": [ + { + "name": "BotCommandScopeDefault" + }, + { + "name": "BotCommandScopeChat", + "chat_id": "owner" + } + ] + }, + "balance": { + "scopes": [ + { + "name": "BotCommandScopeDefault" + }, + { + "name": "BotCommandScopeChat", + "chat_id": "owner" + } + ] + }, + "topup": { + "scopes": [ + { + "name": "BotCommandScopeDefault" + }, + { + "name": "BotCommandScopeChat", + "chat_id": "owner" + } + ] + }, + "setcard": { + "scopes": [ + { + "name": "BotCommandScopeDefault" + }, + { + "name": "BotCommandScopeChat", + "chat_id": "owner" + } + ] + }, + "resetcard": { + "scopes": [ + { + "name": "BotCommandScopeDefault" + }, + { + "name": "BotCommandScopeChat", + "chat_id": "owner" + } + ] + }, + "shutdown": { + "scopes": [ + { + "name": "BotCommandScopeChat", + "chat_id": "owner" + } + ] + } + } } \ No newline at end of file diff --git a/locale/en.json b/locale/en.json new file mode 100644 index 0000000..1ebdb47 --- /dev/null +++ b/locale/en.json @@ -0,0 +1,10 @@ +{ + "commands": { + "help": "Help menu", + "balance": "Card's balance", + "topup": "Refill the card", + "setcard": "Link the card", + "resetcard": "Unlink the card", + "shutdown": "Turn the bot off" + } +} \ No newline at end of file diff --git a/locale/uk.json b/locale/uk.json new file mode 100644 index 0000000..f09aaaf --- /dev/null +++ b/locale/uk.json @@ -0,0 +1,10 @@ +{ + "commands": { + "help": "Меню допомоги", + "balance": "Баланс картки", + "topup": "Поповнити картку", + "setcard": "Прив'язати картку", + "resetcard": "Відв'язати картку", + "shutdown": "Вимкнути бота" + } +} \ No newline at end of file diff --git a/modules/utils.py b/modules/utils.py index 34b3823..04fa494 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -29,7 +29,5 @@ def userReset(userid, key: str): def userGet(userid, key: str): try: return sync.json_read("data/database.json")[str(userid)][key] - except KeyError: - return None - except FileNotFoundError: + except (KeyError, FileNotFoundError): return None