/
kaws
/
Telegram-Referral-Bot
Обзор
Документация
Войти
/
kaws
/
Telegram-Referral-Bot
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/bot/modules/__init__.py
40 строк
1 KB
Apoorva Kumar
shit commit
11 апр 2022, 14:01
11 апр 2022, 14:01
f962a8f
Код
Авторство
О чём код?
from bot import LOAD, NOLOAD, LOGGER def __list_all_modules(): from os.path import dirname, basename, isfile import glob # This generates a list of modules in this folder for the * in __main__ to work. mod_paths = glob.glob(dirname(__file__) + "/*.py") all_modules = [ basename(f)[:-3] for f in mod_paths if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py") ] if LOAD or NOLOAD: to_load = LOAD if to_load: if not all( any(mod == module_name for module_name in all_modules) for mod in to_load ): LOGGER.error("Invalid loadorder names. Quitting.") quit(1) else: to_load = all_modules if NOLOAD: LOGGER.info("Not loading: {}".format(NOLOAD)) return [item for item in to_load if item not in NOLOAD] return to_load return all_modules ALL_MODULES = sorted(__list_all_modules()) LOGGER.info("Modules to load: %s", str(ALL_MODULES)) __all__ = ALL_MODULES + ["ALL_MODULES"]