HOT_FIX_3 add blacklist

fix db init
This commit is contained in:
Andrey
2024-07-16 21:55:22 +03:00
parent 09a071c014
commit 3a30edc1ab
12 changed files with 96 additions and 69 deletions

View File

@@ -2,6 +2,8 @@ import configparser
import os
import sys
from database.db import BotDB
class BaseDependencyFactory:
def __init__(self):
@@ -10,6 +12,8 @@ class BaseDependencyFactory:
self.config = configparser.ConfigParser()
self.config.read(config_path)
self.settings = {}
self.database = BotDB('database/tg-bot-database')
for section in self.config.sections():
self.settings[section] = {}
for key in self.config[section]:
@@ -23,3 +27,7 @@ class BaseDependencyFactory:
def get_settings(self):
return self.settings
def get_db(self) -> BotDB:
"""Возвращает подключение к базе данных."""
return self.database

View File

@@ -3,9 +3,11 @@ from datetime import datetime, timedelta
from aiogram import types
from aiogram.types import InputMediaPhoto
from database.db import BotDB
from helper_bot.utils.base_dependency_factory import BaseDependencyFactory
BotDB = BotDB('database/tg-bot-database')
bdf = BaseDependencyFactory()
BotDB = bdf.get_db()
def get_first_name(message: types.Message) -> str: