diff options
| author | 2023-08-13 12:24:45 +0800 | |
|---|---|---|
| committer | 2023-08-13 12:24:45 +0800 | |
| commit | 4bf6db5200affc2f623aa02301020092c0789d19 (patch) | |
| tree | 9f32d49fb967b16a4f4c79bb39bf3ccff6773b9b /hydroroll/bot.py | |
| parent | c30ca50aab37a86534b3dcd27c253cc79d0c8101 (diff) | |
| download | HydroRoll-4bf6db5200affc2f623aa02301020092c0789d19.tar.gz HydroRoll-4bf6db5200affc2f623aa02301020092c0789d19.zip | |
refactor: 根据tests重构
Diffstat (limited to 'hydroroll/bot.py')
| -rw-r--r-- | hydroroll/bot.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/hydroroll/bot.py b/hydroroll/bot.py deleted file mode 100644 index cbfc07f..0000000 --- a/hydroroll/bot.py +++ /dev/null @@ -1,50 +0,0 @@ -from iamai import Bot as _Bot -from typing import Optional, Dict, List, Type, Any, Union -from pathlib import Path -import os -from hydroroll.config import GlobalConfig - -current_dir = Path.cwd() -script_file = current_dir.resolve() / __file__ -script_dir = script_file.parent - -__all__ = ["Bot"] - -class Bot: - def __init__( - self, - *, - config_file: Optional[str] = "config.toml", - config_dict: Optional[Dict] = None, - hot_reload: bool = False, - ) -> None: - self.bot = _Bot(hot_reload=hot_reload, - config_file=config_file, - config_dict=config_dict - ) - self.bot.load_plugins_from_dirs(Path(f"{script_dir}/plugins")) - self.create_folder_structure(GlobalConfig._folder_dict) - - def run(self) -> None: - self.bot.run() - - def restart(self) -> None: - self.bot.restart() - - def create_folders(self): - folder_path = os.path.dirname(os.path.abspath('__file__')) # 获取main.py所在文件夹路径 - if not os.path.isdir(os.path.join(folder_path, 'user')): - os.mkdir(os.path.join(folder_path, 'user')) - if not os.path.isdir(os.path.join(folder_path, 'data')): - os.mkdir(os.path.join(folder_path, 'data')) - if not os.path.isdir(os.path.join(folder_path, 'models')): - os.mkdir(os.path.join(folder_path, 'models')) - if not os.path.isdir(os.path.join(folder_path, 'web')): - os.mkdir(os.path.join(folder_path, 'web')) - if not os.path.isdir(os.path.join(folder_path, 'config')): - os.mkdir(os.path.join(folder_path, 'config')) - if not os.path.isdir(os.path.join(folder_path, 'logs')): - os.mkdir(os.path.join(folder_path, 'logs')) - if not os.path.isdir(os.path.join(folder_path, 'rules')): - os.mkdir(os.path.join(folder_path, 'rules')) - |
