2024-03-19 20:38:25 +08:00
|
|
|
import nonebot
|
|
|
|
from nonebot import on_command
|
|
|
|
from nonebot.adapters.onebot.v11 import MessageSegment
|
|
|
|
from nonebot.params import CommandArg
|
|
|
|
from nonebot.permission import SUPERUSER
|
|
|
|
|
2024-03-19 21:56:31 +08:00
|
|
|
from src.utils.message import send_markdown
|
|
|
|
from src.utils.typing import T_Message, T_Bot, v11, T_MessageEvent
|
2024-03-19 20:38:25 +08:00
|
|
|
|
|
|
|
md_test = on_command("mdts", aliases={"会话md"}, permission=SUPERUSER)
|
|
|
|
md_group = on_command("mdg", aliases={"群md"}, permission=SUPERUSER)
|
|
|
|
|
|
|
|
placeholder = {
|
|
|
|
"[": "[",
|
|
|
|
"]": "]",
|
|
|
|
"&": "&",
|
|
|
|
",": ",",
|
2024-03-19 21:56:31 +08:00
|
|
|
"\n": r"\n",
|
|
|
|
"\"": r'\\\"'
|
2024-03-19 20:38:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-03-19 21:56:31 +08:00
|
|
|
@md_test.handle()
|
2024-03-19 20:38:25 +08:00
|
|
|
async def _(bot: T_Bot, event: T_MessageEvent, arg: v11.Message = CommandArg()):
|
2024-03-19 21:56:31 +08:00
|
|
|
await send_markdown(
|
|
|
|
str(arg),
|
|
|
|
bot,
|
|
|
|
message_type=event.message_type,
|
|
|
|
session_id=event.user_id if event.message_type == "private" else event.group_id
|
2024-03-20 00:44:36 +08:00
|
|
|
)
|