20 lines
590 B
Python
20 lines
590 B
Python
# cmd_twitch/__init__.py
|
|
import os
|
|
import importlib
|
|
|
|
def setup(bot):
|
|
"""
|
|
Dynamically load all commands from the cmd_twitch folder.
|
|
"""
|
|
# Get a list of all command files (excluding __init__.py)
|
|
command_files = [
|
|
f.replace('.py', '') for f in os.listdir(os.path.dirname(__file__))
|
|
if f.endswith('.py') and f != '__init__.py'
|
|
]
|
|
|
|
# Import and set up each command module
|
|
for command in command_files:
|
|
module = importlib.import_module(f".{command}", package='cmd_twitch')
|
|
if hasattr(module, 'setup'):
|
|
module.setup(bot)
|