diff --git a/README.md b/README.md index 3ca93c03..33bd3385 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,7 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ * 修复非超级用户绑定原神cookie会被black_word阻拦 * 修复webui中plugins2setting修改时会改变plugins2setting.cmd为字符串 * 修复微博热搜报错,发红包小bug [@pull/688](https://github.com/HibiKier/zhenxun_bot/pull/688) +* 更多的中文提示 ### 2022/5/26 diff --git a/basic_plugins/hooks/auth_hook.py b/basic_plugins/hooks/auth_hook.py index 7e79dc24..83c4d77f 100755 --- a/basic_plugins/hooks/auth_hook.py +++ b/basic_plugins/hooks/auth_hook.py @@ -91,7 +91,10 @@ async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State): except AttributeError: pass # 群黑名单检测 群总开关检测 - if isinstance(event, GroupMessageEvent) or matcher.plugin_name in other_limit_plugins: + if ( + isinstance(event, GroupMessageEvent) + or matcher.plugin_name in other_limit_plugins + ): try: if ( group_manager.get_group_level(event.group_id) < 0 @@ -148,7 +151,11 @@ async def _(matcher: Matcher, bot: Bot, event: Event, state: T_State): raise IgnoredException("权限不足") if module in plugins2info_dict.keys() and matcher.priority not in [1, 999]: # 戳一戳单独判断 - if isinstance(event, GroupMessageEvent) or isinstance(event, PokeNotifyEvent) or matcher.plugin_name in other_limit_plugins: + if ( + isinstance(event, GroupMessageEvent) + or isinstance(event, PokeNotifyEvent) + or matcher.plugin_name in other_limit_plugins + ): if status_message_manager.get(event.group_id) is None: status_message_manager.delete(event.group_id) if plugins2info_dict[module]["level"] > group_manager.get_group_level( diff --git a/basic_plugins/init_plugin_config/init_plugins_config.py b/basic_plugins/init_plugin_config/init_plugins_config.py index 4340cffa..033f6eb3 100755 --- a/basic_plugins/init_plugin_config/init_plugins_config.py +++ b/basic_plugins/init_plugin_config/init_plugins_config.py @@ -82,7 +82,10 @@ def init_plugins_config(data_path): _data[plugin].yaml_set_start_comment(plugin_name, indent=2) # 初始化未设置的管理员权限等级 for k, v in Config.get_admin_level_data(): - admin_manager.set_admin_level(k, v) + try: + admin_manager.set_admin_level(k, v) + except KeyError as e: + raise KeyError(f"{e} ****** 请检查是否有插件加载失败 ******") # 存完插件基本设置 with open(plugins2config_file, "w", encoding="utf8") as wf: round_trip_dump( diff --git a/services/db_context.py b/services/db_context.py index 86139a1f..e67c8a74 100755 --- a/services/db_context.py +++ b/services/db_context.py @@ -1,6 +1,7 @@ from gino import Gino from .log import logger +from utils.text_utils import prompt2cn from configs.config import bind, sql_name, user, password, address, port, database @@ -9,6 +10,8 @@ db = Gino() async def init(): + if not bind and (not user and not password and not address and not port and not database): + raise ValueError("\n" + prompt2cn("数据库配置未填写", 28)) i_bind = bind if not i_bind: i_bind = f"{sql_name}://{user}:{password}@{address}:{port}/{database}"