From f5299b78cd3b5925d59ba2bd94f082c9dc06f71a Mon Sep 17 00:00:00 2001 From: Kirill Kirilenko Date: Sun, 1 Feb 2026 20:36:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8?= =?UTF-8?q?=D0=B3=D1=83=D1=80=D0=B0=D1=86=D0=B8=D0=BE=D0=BD=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=B0=D1=80?= =?UTF-8?q?=D0=B3=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=BC=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B4=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BA=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tg/__main__.py | 8 +++++++- vk/__main__.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tg/__main__.py b/tg/__main__.py index 20db6b6..af58428 100644 --- a/tg/__main__.py +++ b/tg/__main__.py @@ -1,3 +1,4 @@ +import argparse import asyncio import json @@ -12,7 +13,12 @@ from . import tasks async def main() -> None: - with open('tg.json', 'r') as file: + parser = argparse.ArgumentParser(description='Telegram chat bot') + parser.add_argument('-c', '--config', type=str, required=True, + help='Path to the JSON configuration file') + args = parser.parse_args() + + with open(args.config, 'r') as file: config = json.load(file) print('Конфигурация загружена.') diff --git a/vk/__main__.py b/vk/__main__.py index 98411a9..3073d4d 100644 --- a/vk/__main__.py +++ b/vk/__main__.py @@ -1,3 +1,4 @@ +import argparse import json from vkbottle.bot import Bot, run_multibot @@ -12,7 +13,12 @@ from .utils import MyAPI if __name__ == '__main__': - with open('vk.json', 'r') as file: + parser = argparse.ArgumentParser(description='Telegram chat bot') + parser.add_argument('-c', '--config', type=str, required=True, + help='Path to the JSON configuration file') + args = parser.parse_args() + + with open(args.config, 'r') as file: config = json.load(file) print('Конфигурация загружена.')