Compare commits

...

2 commits

4 changed files with 18 additions and 6 deletions

View file

@ -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('Конфигурация загружена.')

View file

@ -10,7 +10,7 @@ class TgDatabase(database.BasicDatabase):
id BIGINT NOT NULL,
owner_id BIGINT NOT NULL,
api_token VARCHAR(64) NOT NULL,
ai_prompt VARCHAR(4000) DEFAULT NULL,
ai_prompt VARCHAR(2000) DEFAULT NULL,
group_chats_allowed TINYINT NOT NULL DEFAULT 1,
private_chats_allowed TINYINT NOT NULL DEFAULT 1,
PRIMARY KEY (id))
@ -23,7 +23,7 @@ class TgDatabase(database.BasicDatabase):
active TINYINT NOT NULL DEFAULT 0,
rules VARCHAR(4000),
greeting_join VARCHAR(2000),
ai_prompt VARCHAR(4000),
ai_prompt VARCHAR(2000),
PRIMARY KEY (bot_id, chat_id),
CONSTRAINT fk_chats_bots FOREIGN KEY (bot_id) REFERENCES bots (id) ON DELETE CASCADE ON UPDATE CASCADE)
""")

View file

@ -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('Конфигурация загружена.')

View file

@ -10,7 +10,7 @@ class VkDatabase(database.BasicDatabase):
id BIGINT NOT NULL,
owner_id BIGINT NOT NULL,
api_token VARCHAR(256) NOT NULL,
ai_prompt VARCHAR(4000) DEFAULT NULL,
ai_prompt VARCHAR(2000) DEFAULT NULL,
group_chats_allowed TINYINT NOT NULL DEFAULT 1,
private_chats_allowed TINYINT NOT NULL DEFAULT 1,
PRIMARY KEY (id))
@ -25,7 +25,7 @@ class VkDatabase(database.BasicDatabase):
greeting_join VARCHAR(2000),
greeting_rejoin VARCHAR(2000),
birthday_message VARCHAR(2000),
ai_prompt VARCHAR(4000),
ai_prompt VARCHAR(2000),
PRIMARY KEY (bot_id, chat_id),
CONSTRAINT fk_chats_bots FOREIGN KEY (bot_id) REFERENCES bots (id) ON DELETE CASCADE ON UPDATE CASCADE)
""")