forked from swatv3nub/PyrogramBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
26 lines (21 loc) · 692 Bytes
/
__init__.py
File metadata and controls
26 lines (21 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import glob
import importlib
import sys
from os.path import dirname, basename, isfile
from PyrogramBot import log
def __list_all_modules():
# 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")
and not f.endswith("__main__.py")
]
importlib.import_module("PyrogramBot.modules.__main__")
ALL_MODULES = sorted(__list_all_modules())
log.info("Modules loaded: %s", str(ALL_MODULES))
__all__ = ALL_MODULES + ["ALL_MODULES"]