mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ message_build支持AtAll (#1639)
This commit is contained in:
parent
6f635ed978
commit
983248374d
@ -2,12 +2,12 @@ from io import BytesIO
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import nonebot
|
import nonebot
|
||||||
from nonebot.adapters.onebot.v11 import Message, MessageSegment
|
|
||||||
from nonebot_plugin_alconna import At, Image, Text, UniMessage, Video, Voice
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
from nonebot.adapters.onebot.v11 import Message, MessageSegment
|
||||||
|
from nonebot_plugin_alconna import At, Text, AtAll, Image, Video, Voice, UniMessage
|
||||||
|
|
||||||
from zhenxun.configs.config import BotConfig
|
|
||||||
from zhenxun.services.log import logger
|
from zhenxun.services.log import logger
|
||||||
|
from zhenxun.configs.config import BotConfig
|
||||||
from zhenxun.utils._build_image import BuildImage
|
from zhenxun.utils._build_image import BuildImage
|
||||||
|
|
||||||
driver = nonebot.get_driver()
|
driver = nonebot.get_driver()
|
||||||
@ -21,6 +21,7 @@ MESSAGE_TYPE = (
|
|||||||
| BytesIO
|
| BytesIO
|
||||||
| BuildImage
|
| BuildImage
|
||||||
| At
|
| At
|
||||||
|
| AtAll
|
||||||
| Image
|
| Image
|
||||||
| Text
|
| Text
|
||||||
| Voice
|
| Voice
|
||||||
@ -33,7 +34,6 @@ class Config(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class MessageUtils:
|
class MessageUtils:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __build_message(cls, msg_list: list[MESSAGE_TYPE]) -> list[Text | Image]:
|
def __build_message(cls, msg_list: list[MESSAGE_TYPE]) -> list[Text | Image]:
|
||||||
"""构造消息
|
"""构造消息
|
||||||
@ -47,7 +47,7 @@ class MessageUtils:
|
|||||||
config = nonebot.get_plugin_config(Config)
|
config = nonebot.get_plugin_config(Config)
|
||||||
message_list = []
|
message_list = []
|
||||||
for msg in msg_list:
|
for msg in msg_list:
|
||||||
if isinstance(msg, Image | Text | At | Video | Voice):
|
if isinstance(msg, Image | Text | At | AtAll | Video | Voice):
|
||||||
message_list.append(msg)
|
message_list.append(msg)
|
||||||
elif isinstance(msg, str | int | float):
|
elif isinstance(msg, str | int | float):
|
||||||
message_list.append(Text(str(msg)))
|
message_list.append(Text(str(msg)))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user