mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Fixed error in custom_welcome_msg and message_builder
This commit is contained in:
parent
c674d581b7
commit
76df21036a
@ -75,7 +75,7 @@ async def custom_group_welcome(
|
|||||||
await AsyncHttpx.download_file(
|
await AsyncHttpx.download_file(
|
||||||
img, DATA_PATH / "custom_welcome_msg" / f"{group_id}.jpg"
|
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} 更换群欢迎消息图片")
|
logger.info(f"USER {user_id} GROUP {group_id} 更换群欢迎消息图片")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"GROUP {group_id} 替换群消息失败 e:{e}")
|
logger.error(f"GROUP {group_id} 替换群消息失败 e:{e}")
|
||||||
|
|||||||
@ -129,7 +129,7 @@ async def _(bot: Bot, event: GroupIncreaseNoticeEvent):
|
|||||||
at_flag = True
|
at_flag = True
|
||||||
if (DATA_PATH / "custom_welcome_msg" / f"{event.group_id}.jpg").exists():
|
if (DATA_PATH / "custom_welcome_msg" / f"{event.group_id}.jpg").exists():
|
||||||
img = image(
|
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:
|
if msg or img:
|
||||||
msg = msg.strip() + img
|
msg = msg.strip() + img
|
||||||
|
|||||||
@ -25,7 +25,7 @@ def image(
|
|||||||
"""
|
"""
|
||||||
if abspath:
|
if abspath:
|
||||||
if isinstance(abspath, Path):
|
if isinstance(abspath, Path):
|
||||||
return MessageSegment.image(file)
|
return MessageSegment.image(abspath)
|
||||||
return (
|
return (
|
||||||
MessageSegment.image("file:///" + abspath)
|
MessageSegment.image("file:///" + abspath)
|
||||||
if os.path.exists(abspath)
|
if os.path.exists(abspath)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user