migrate to aiogram 3.10.0
This commit is contained in:
25
helper_bot/utils/base_dependency_factory.py
Normal file
25
helper_bot/utils/base_dependency_factory.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import configparser
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
class BaseDependencyFactory:
|
||||
def __init__(self):
|
||||
# Загрузка настроек из settings.ini
|
||||
config_path = os.path.join(sys.path[0], 'settings.ini')
|
||||
self.config = configparser.ConfigParser()
|
||||
self.config.read(config_path)
|
||||
self.settings = {}
|
||||
for section in self.config.sections():
|
||||
self.settings[section] = {}
|
||||
for key in self.config[section]:
|
||||
# Преобразование значений в соответствующий тип
|
||||
if key == 'PREVIEW_LINK':
|
||||
self.settings[section][key] = self.config.getboolean(section, key)
|
||||
elif key == 'LOGS' or key == 'TEST':
|
||||
self.settings[section][key] = self.config.getboolean(section, key)
|
||||
else:
|
||||
self.settings[section][key] = self.config.get(section, key)
|
||||
|
||||
def get_settings(self):
|
||||
return self.settings
|
||||
Reference in New Issue
Block a user