mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-07-27 19:10:55 +00:00
: bug: 哈哈哈哈哈哈哈,markdown又寄了
This commit is contained in:
@ -22,9 +22,12 @@ from nonebot_plugin_htmlrender import md_to_pic
|
||||
config = load_from_yaml("config.yml")
|
||||
|
||||
can_send_markdown = {} # 用于存储机器人是否支持发送markdown消息,id->bool
|
||||
|
||||
|
||||
class TencentBannedMarkdownError(BaseException):
|
||||
pass
|
||||
|
||||
|
||||
async def broadcast_to_superusers(message: str | T_Message, markdown: bool = False):
|
||||
"""广播消息给超级用户"""
|
||||
for bot in nonebot.get_bots().values():
|
||||
@ -65,16 +68,38 @@ class MarkdownMessage:
|
||||
message_type = event.message_type
|
||||
session_id = event.user_id if event.message_type == "private" else event.group_id
|
||||
try:
|
||||
# raise TencentBannedMarkdownError("Tencent banned markdown")
|
||||
raise TencentBannedMarkdownError("Tencent banned markdown")
|
||||
forward_id = await bot.call_api(
|
||||
"send_private_forward_msg",
|
||||
messages=[
|
||||
{
|
||||
"type": "node",
|
||||
"data": {
|
||||
"content": [
|
||||
{
|
||||
"data": {
|
||||
"content": "{\"content\":\"%s\"}" % formatted_md,
|
||||
},
|
||||
"type": "markdown"
|
||||
}
|
||||
],
|
||||
"name" : "[]",
|
||||
"uin" : bot.self_id
|
||||
}
|
||||
}
|
||||
],
|
||||
user_id=bot.self_id
|
||||
|
||||
)
|
||||
data = await bot.send_msg(
|
||||
user_id=session_id,
|
||||
group_id=session_id,
|
||||
message_type=message_type,
|
||||
message=[
|
||||
{
|
||||
"type": "markdown",
|
||||
"type": "longmsg",
|
||||
"data": {
|
||||
"content": "{\"content\":\"%s\"}" % formatted_md,
|
||||
"id": forward_id
|
||||
}
|
||||
},
|
||||
],
|
||||
|
Reference in New Issue
Block a user