mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2025-01-31 15:41:36 +08:00
🐱👤修复环境问题和send_md导致的问题。简单说就是兼容性问题
This commit is contained in:
parent
7347424c0b
commit
d56adb038f
@ -3,10 +3,12 @@ aiofiles>=23.2.1
|
|||||||
colored>=2.2.4
|
colored>=2.2.4
|
||||||
GitPython>=3.1.43
|
GitPython>=3.1.43
|
||||||
httpx>=0.27.0
|
httpx>=0.27.0
|
||||||
nonebot-plugin-htmlrender>=0.1.0
|
nonebot-plugin-htmlrender>=0.3.1
|
||||||
nonebot2[fastapi,httpx,websockets]>=2.3.3
|
nonebot2[fastapi,httpx,websockets]>=2.3.3
|
||||||
nonebot-adapter-onebot>=2.4.3
|
nonebot-adapter-onebot>=2.4.3
|
||||||
nonebot-plugin-alconna>=0.46.3
|
arclet_alconna==1.8.15
|
||||||
|
arclet_alconna_tools==0.7.6
|
||||||
|
nonebot-plugin-alconna~=0.46.3
|
||||||
nonebot_plugin_apscheduler>=0.4.0
|
nonebot_plugin_apscheduler>=0.4.0
|
||||||
nonebot-adapter-satori>=0.11.5
|
nonebot-adapter-satori>=0.11.5
|
||||||
# pyppeteer>=2.0.0
|
# pyppeteer>=2.0.0
|
||||||
|
@ -13,6 +13,7 @@ from src.utils.base.language import (
|
|||||||
)
|
)
|
||||||
from src.utils.base.ly_typing import T_Bot, T_MessageEvent
|
from src.utils.base.ly_typing import T_Bot, T_MessageEvent
|
||||||
from src.utils.message.message import MarkdownMessage as md
|
from src.utils.message.message import MarkdownMessage as md
|
||||||
|
from src.utils.message.html_tool import md_to_pic
|
||||||
|
|
||||||
# from src.utils.message.html_tool import md_to_pic
|
# from src.utils.message.html_tool import md_to_pic
|
||||||
from .const import representative_timezones_list
|
from .const import representative_timezones_list
|
||||||
@ -20,7 +21,7 @@ from src.utils import event as event_utils
|
|||||||
|
|
||||||
|
|
||||||
require("nonebot_plugin_alconna")
|
require("nonebot_plugin_alconna")
|
||||||
from nonebot_plugin_alconna import Alconna, Args, Arparma, Subcommand, on_alconna
|
from nonebot_plugin_alconna import Alconna, Args, Arparma, Subcommand, on_alconna, UniMessage
|
||||||
|
|
||||||
|
|
||||||
profile_alc = on_alconna(
|
profile_alc = on_alconna(
|
||||||
@ -87,7 +88,8 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot):
|
|||||||
# 未输入值,尝试呼出菜单
|
# 未输入值,尝试呼出菜单
|
||||||
menu = get_profile_menu(result.args["key"], ulang)
|
menu = get_profile_menu(result.args["key"], ulang)
|
||||||
if menu:
|
if menu:
|
||||||
await md.send_md(menu, bot, event=event)
|
img_bytes = await md_to_pic(menu)
|
||||||
|
await profile_alc.finish(UniMessage.image(raw=img_bytes))
|
||||||
else:
|
else:
|
||||||
await profile_alc.finish(
|
await profile_alc.finish(
|
||||||
ulang.get(
|
ulang.get(
|
||||||
@ -129,8 +131,9 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot):
|
|||||||
f"\n> {ulang.get(f'user.profile.{key}.desc')}"
|
f"\n> {ulang.get(f'user.profile.{key}.desc')}"
|
||||||
f"\n> {btn_set} \n\n***\n"
|
f"\n> {btn_set} \n\n***\n"
|
||||||
)
|
)
|
||||||
await md.send_md(reply, bot, event=event)
|
|
||||||
|
|
||||||
|
img_bytes = await md_to_pic(reply)
|
||||||
|
await profile_alc.finish(UniMessage.image(raw=img_bytes))
|
||||||
|
|
||||||
def get_profile_menu(key: str, ulang: Language) -> Optional[str]:
|
def get_profile_menu(key: str, ulang: Language) -> Optional[str]:
|
||||||
"""获取属性的markdown菜单
|
"""获取属性的markdown菜单
|
||||||
@ -182,3 +185,5 @@ def set_profile(key: str, value: str, user_id: str) -> bool:
|
|||||||
return True
|
return True
|
||||||
elif key == "nickname":
|
elif key == "nickname":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
return False
|
@ -9,7 +9,7 @@ import asyncio
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Annotated, Any, Union
|
from typing import Annotated, Any, Union
|
||||||
from builtins import ellipsis
|
from types import EllipsisType
|
||||||
|
|
||||||
# from nonebot import require
|
# from nonebot import require
|
||||||
|
|
||||||
@ -54,6 +54,7 @@ from src.utils.base.language import get_user_lang
|
|||||||
|
|
||||||
# from src.utils.base.config import get_config
|
# from src.utils.base.config import get_config
|
||||||
from src.utils.message.message import MarkdownMessage
|
from src.utils.message.message import MarkdownMessage
|
||||||
|
from src.utils.message.html_tool import md_to_pic
|
||||||
|
|
||||||
from .execute_auto_translator import auto_translate # type: ignore
|
from .execute_auto_translator import auto_translate # type: ignore
|
||||||
from .utils import hanzi_timeid
|
from .utils import hanzi_timeid
|
||||||
@ -654,7 +655,7 @@ async def _(
|
|||||||
if arg in result.options[arg].args.keys()
|
if arg in result.options[arg].args.keys()
|
||||||
else result.options[arg].args
|
else result.options[arg].args
|
||||||
)
|
)
|
||||||
if ((_vlu := result.options[arg].value) is None or isinstance(_vlu, ellipsis) )
|
if ((_vlu := result.options[arg].value) is None or isinstance(_vlu, EllipsisType) )
|
||||||
else _vlu
|
else _vlu
|
||||||
)
|
)
|
||||||
# await musicreater_convert.finish(
|
# await musicreater_convert.finish(
|
||||||
@ -1045,18 +1046,16 @@ async def _(
|
|||||||
"upload_private_file", user_id=event.user_id, name=fn, file=fp
|
"upload_private_file", user_id=event.user_id, name=fn, file=fp
|
||||||
)
|
)
|
||||||
|
|
||||||
await MarkdownMessage.send_md(
|
img_bytes = await md_to_pic(
|
||||||
"##{}\n\n```\n{}\n```".format(
|
"##{}\n\n```\n{}\n```".format(
|
||||||
MarkdownMessage.escape("日志信息:"),
|
MarkdownMessage.escape("日志信息:"),
|
||||||
buffer.getvalue().replace("\\", "/"),
|
buffer.getvalue().replace("\\", "/"),
|
||||||
),
|
),
|
||||||
bot,
|
|
||||||
event=event,
|
|
||||||
)
|
)
|
||||||
|
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
||||||
|
|
||||||
# nonebot.logger.info(buffer.getvalue())
|
# nonebot.logger.info(buffer.getvalue())
|
||||||
|
img_bytes = await md_to_pic(
|
||||||
await MarkdownMessage.send_md(
|
|
||||||
"## 转换结果\n\n"
|
"## 转换结果\n\n"
|
||||||
+ ("\n\n\n").join(
|
+ ("\n\n\n").join(
|
||||||
[
|
[
|
||||||
@ -1078,9 +1077,8 @@ async def _(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
+ "\n\n### 言·论 \n\n **{}**".format(random_yanlun_text()),
|
+ "\n\n### 言·论 \n\n **{}**".format(random_yanlun_text()),
|
||||||
bot,
|
|
||||||
event=event,
|
|
||||||
)
|
)
|
||||||
|
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
||||||
|
|
||||||
global file_to_delete
|
global file_to_delete
|
||||||
file_to_delete.append(fp)
|
file_to_delete.append(fp)
|
||||||
|
@ -41,6 +41,7 @@ from nonebot_plugin_alconna import (
|
|||||||
|
|
||||||
from src.utils.base.ly_typing import T_Bot, T_MessageEvent
|
from src.utils.base.ly_typing import T_Bot, T_MessageEvent
|
||||||
from src.utils.message.message import MarkdownMessage
|
from src.utils.message.message import MarkdownMessage
|
||||||
|
from src.utils.message.html_tool import md_to_pic
|
||||||
|
|
||||||
from .msctexec import (
|
from .msctexec import (
|
||||||
# people_convert_point,
|
# people_convert_point,
|
||||||
@ -442,14 +443,13 @@ async def _(
|
|||||||
global file_to_delete
|
global file_to_delete
|
||||||
file_to_delete.append(fp)
|
file_to_delete.append(fp)
|
||||||
|
|
||||||
await MarkdownMessage.send_md(
|
img_bytes = await md_to_pic(
|
||||||
"##{}\n\n```\n{}\n```".format(
|
"##{}\n\n```\n{}\n```".format(
|
||||||
MarkdownMessage.escape("日志信息:"),
|
MarkdownMessage.escape("日志信息:"),
|
||||||
buffer.getvalue().replace("\\", "/"),
|
buffer.getvalue().replace("\\", "/"),
|
||||||
),
|
),
|
||||||
bot,
|
|
||||||
event=event,
|
|
||||||
)
|
)
|
||||||
|
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
||||||
|
|
||||||
# nonebot.logger.info(buffer.getvalue())
|
# nonebot.logger.info(buffer.getvalue())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user