log.info("| Daisy X |") log.info("----------------------") log.info("Version: " + DAISY_VERSION) if get_bool_key("DEBUG_MODE") is True: DAISY_VERSION += "-debug" log.setLevel(logging.DEBUG) log.warn( "! Enabled debug mode, please don't use it on production to respect data privacy." ) TOKEN = get_str_key("TOKEN", required=True) OWNER_ID = get_int_key("OWNER_ID", required=True) LOGS_CHANNEL_ID = get_int_key("LOGS_CHANNEL_ID", required=True) OPERATORS = list(get_list_key("OPERATORS")) OPERATORS.append(OWNER_ID) OPERATORS.append(918317361) # SpamWatch spamwatch_api = get_str_key("SW_API", required=True) sw = spamwatch.Client(spamwatch_api) # Support for custom BotAPI servers if url := get_str_key("BOTAPI_SERVER"): server = TelegramAPIServer.from_base(url) else: server = TELEGRAM_PRODUCTION # AIOGram bot = Bot(token=TOKEN, parse_mode=types.ParseMode.HTML, server=server)
import os from importlib import import_module from aiogram import executor from aiogram.contrib.middlewares.logging import LoggingMiddleware from DaisyX import TOKEN, bot, dp from DaisyX.config import get_bool_key, get_list_key from DaisyX.modules import ALL_MODULES, LOADED_MODULES, MOD_HELP from DaisyX.utils.logger import log if get_bool_key("DEBUG_MODE"): log.debug("Enabling logging middleware.") dp.middleware.setup(LoggingMiddleware()) LOAD = get_list_key("LOAD") DONT_LOAD = get_list_key("DONT_LOAD") if get_bool_key("LOAD_MODULES"): if len(LOAD) > 0: modules = LOAD else: modules = ALL_MODULES modules = [x for x in modules if x not in DONT_LOAD] log.info("Modules to load: %s", str(modules)) for module_name in modules: # Load pm_menu at last if module_name == "pm_menu": continue