19 lines
696 B
Python
19 lines
696 B
Python
import os
|
|
import importlib
|
|
|
|
import nerimity
|
|
|
|
class Bot(nerimity.Client):
|
|
"""Extended client class for extra functionality."""
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
def load_commands(self, commands_dir: str):
|
|
for filename in os.listdir(commands_dir):
|
|
if filename.endswith(".py") and not filename.startswith("_"):
|
|
module_name = f"{commands_dir}.{filename[:-3]}"
|
|
module = importlib.import_module(module_name)
|
|
if hasattr(module, "setup"):
|
|
module.setup(self)
|
|
print(f"Loaded {module_name}")
|
|
print("Registered commands:", self.commands)
|