Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaneshwar-singh authored Jan 11, 2021
1 parent 24958b6 commit d841d2b
Show file tree
Hide file tree
Showing 74 changed files with 14,758 additions and 0 deletions.
37 changes: 37 additions & 0 deletions fire_bot/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from tg_bot import LOAD, NO_LOAD, 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 NO_LOAD:
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)

all_modules = sorted(set(all_modules) - set(to_load))
to_load = list(all_modules) + to_load

else:
to_load = all_modules

if NO_LOAD:
LOGGER.info("Not loading: {}".format(NO_LOAD))
return [item for item in to_load if item not in NO_LOAD]

return to_load

return all_modules


ALL_MODULES = __list_all_modules()
LOGGER.info("Modules to load: %s", str(ALL_MODULES))
__all__ = ALL_MODULES + ["ALL_MODULES"]
Loading

0 comments on commit d841d2b

Please sign in to comment.