aboutsummaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'util.py')
-rw-r--r--util.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/util.py b/util.py
new file mode 100644
index 0000000..cf80109
--- /dev/null
+++ b/util.py
@@ -0,0 +1,11 @@
+import os
+
+from discord.ext.commands import Bot
+
+
+def load_all_modules(bot: Bot, module_folder='modules', module_package=None):
+ if module_package is None:
+ module_package = module_folder.replace('/', '.')
+ for module in os.listdir(module_folder):
+ if module.endswith('.py') and not module.startswith('_'):
+ bot.load_extension(module_package + '.' + module[:-3])