From 76df21036abe068a58de9f0fba14850d74dd0a11 Mon Sep 17 00:00:00 2001 From: NovaNo1r Date: Wed, 23 Feb 2022 21:45:53 -0800 Subject: [PATCH] Fixed error in custom_welcome_msg and message_builder --- basic_plugins/admin_bot_manage/_data_source.py | 2 +- basic_plugins/group_handle/__init__.py | 2 +- utils/message_builder.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/basic_plugins/admin_bot_manage/_data_source.py b/basic_plugins/admin_bot_manage/_data_source.py index 0a09a3b8..f2fb183c 100644 --- a/basic_plugins/admin_bot_manage/_data_source.py +++ b/basic_plugins/admin_bot_manage/_data_source.py @@ -75,7 +75,7 @@ async def custom_group_welcome( await AsyncHttpx.download_file( img, DATA_PATH / "custom_welcome_msg" / f"{group_id}.jpg" ) - img_result = image(abspath=DATA_PATH / "custom_welcome_msg" / f"{group_id}.jpg") + img_result = image(DATA_PATH / "custom_welcome_msg" / f"{group_id}.jpg") logger.info(f"USER {user_id} GROUP {group_id} 更换群欢迎消息图片") except Exception as e: logger.error(f"GROUP {group_id} 替换群消息失败 e:{e}") diff --git a/basic_plugins/group_handle/__init__.py b/basic_plugins/group_handle/__init__.py index c4583aff..da3dd75c 100755 --- a/basic_plugins/group_handle/__init__.py +++ b/basic_plugins/group_handle/__init__.py @@ -129,7 +129,7 @@ async def _(bot: Bot, event: GroupIncreaseNoticeEvent): at_flag = True if (DATA_PATH / "custom_welcome_msg" / f"{event.group_id}.jpg").exists(): img = image( - abspath=DATA_PATH / "custom_welcome_msg" / f"{event.group_id}.jpg" + DATA_PATH / "custom_welcome_msg" / f"{event.group_id}.jpg" ) if msg or img: msg = msg.strip() + img diff --git a/utils/message_builder.py b/utils/message_builder.py index 0e01e627..2885eaee 100755 --- a/utils/message_builder.py +++ b/utils/message_builder.py @@ -25,7 +25,7 @@ def image( """ if abspath: if isinstance(abspath, Path): - return MessageSegment.image(file) + return MessageSegment.image(abspath) return ( MessageSegment.image("file:///" + abspath) if os.path.exists(abspath)