mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
add get_message_img_file
This commit is contained in:
parent
188ae38525
commit
c0d055b825
@ -229,6 +229,25 @@ def get_message_img(data: Union[str, Message]) -> List[str]:
|
|||||||
return img_list
|
return img_list
|
||||||
|
|
||||||
|
|
||||||
|
def get_message_img_file(data: Union[str, Message]) -> List[str]:
|
||||||
|
"""
|
||||||
|
说明:
|
||||||
|
获取消息中所有的 图片file
|
||||||
|
参数:
|
||||||
|
:param data: event.json()
|
||||||
|
"""
|
||||||
|
file_list = []
|
||||||
|
if isinstance(data, str):
|
||||||
|
data = json.loads(data)
|
||||||
|
for msg in data["message"]:
|
||||||
|
if msg["type"] == "image":
|
||||||
|
file_list.append(msg["data"]["file"])
|
||||||
|
else:
|
||||||
|
for seg in data["image"]:
|
||||||
|
file_list.append(seg.data["file"])
|
||||||
|
return file_list
|
||||||
|
|
||||||
|
|
||||||
def get_message_text(data: Union[str, Message]) -> str:
|
def get_message_text(data: Union[str, Message]) -> str:
|
||||||
"""
|
"""
|
||||||
说明:
|
说明:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user