mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-07-27 22:40:55 +00:00
✨ 预渲染数据,发送更快
This commit is contained in:
@ -6,6 +6,7 @@ import aiohttp
|
||||
from PIL import Image
|
||||
|
||||
from ..base.config import get_config
|
||||
from ..base.data import LiteModel
|
||||
from ..base.ly_typing import T_Bot
|
||||
|
||||
|
||||
@ -195,3 +196,14 @@ class Mqqapi:
|
||||
# 若命令前缀不为空,则使用配置的第一个命令前缀
|
||||
cmd = f"{command_start[0]}{cmd}"
|
||||
return f"[{text}](mqqapi://aio/inlinecmd?command={quote(cmd)}&reply={str(reply).lower()}&enter={str(enter).lower()})"
|
||||
|
||||
|
||||
class RenderData(LiteModel):
|
||||
label: str
|
||||
visited_label: str
|
||||
style: int
|
||||
|
||||
|
||||
class Button(LiteModel):
|
||||
id: int
|
||||
render_data: RenderData
|
||||
|
@ -64,28 +64,6 @@ class MarkdownMessage:
|
||||
message_type = event.message_type
|
||||
session_id = event.user_id if event.message_type == "private" else event.group_id
|
||||
try:
|
||||
# 构建Markdown消息并获取转发消息ID
|
||||
# forward_id = await bot.call_api(
|
||||
# api="send_forward_msg",
|
||||
# messages=[
|
||||
# v11.MessageSegment(
|
||||
# type="node",
|
||||
# data={
|
||||
# "name" : "Liteyuki.OneBot",
|
||||
# "uin" : bot.self_id,
|
||||
# "content": [
|
||||
# {
|
||||
# "type": "markdown",
|
||||
# "data": {
|
||||
# "content": '{"content":"%s"}' % formatted_md
|
||||
# }
|
||||
# },
|
||||
# ]
|
||||
# },
|
||||
# )
|
||||
# ]
|
||||
# )
|
||||
# 发送Markdown longmsg并获取相应数据
|
||||
data = await bot.send_msg(
|
||||
user_id=session_id,
|
||||
group_id=session_id,
|
||||
@ -94,27 +72,39 @@ class MarkdownMessage:
|
||||
{
|
||||
"type": "markdown",
|
||||
"data": {
|
||||
"content": "{\"content\":\"%s\"}" % formatted_md
|
||||
"content": "{\"content\":\"%s\"}" % formatted_md,
|
||||
}
|
||||
}
|
||||
},
|
||||
# {
|
||||
# "type": "keyboard",
|
||||
# "data": {
|
||||
# "content": {
|
||||
# "rows": [
|
||||
# {
|
||||
# "buttons": [
|
||||
# {
|
||||
# "render_data": {
|
||||
# "label" : "NPM",
|
||||
# "visited_label": "NPM已点击",
|
||||
# "style" : 1
|
||||
# },
|
||||
# "action" : {
|
||||
# "type" : 2,
|
||||
# "enter" : True,
|
||||
# "permission": {
|
||||
# "type": 2
|
||||
# },
|
||||
# "data" : "npm"
|
||||
#
|
||||
# }
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
],
|
||||
# messages=[
|
||||
# v11.MessageSegment(
|
||||
# type="node",
|
||||
# data={
|
||||
# "name": "Liteyuki.OneBot",
|
||||
# "uin": bot.self_id,
|
||||
# "content": [
|
||||
# {
|
||||
# "type": "markdown",
|
||||
# "data": {
|
||||
# "content": '{"content":"%s"}' % formatted_md
|
||||
# }
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# ),
|
||||
# ],
|
||||
**kwargs
|
||||
)
|
||||
except BaseException as e:
|
||||
|
Reference in New Issue
Block a user