HOT_FIX_3 add blacklist
fix db init
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user