matrix-bot/matrix_bot/plugins/__init__.py

14 lines
303 B
Python
Raw Normal View History

2020-08-06 17:16:43 +02:00
import importlib
import os
import pkgutil
pkg_dir = os.path.dirname(__file__)
all_plugins = {}
for (module_loader, name, ispkg) in pkgutil.iter_modules([pkg_dir]):
if not name.startswith('_'):
cls = importlib.import_module('.' + name, __package__).Plugin
all_plugins[name] = cls