2024-04-17 17:45:32 +08:00
|
|
|
from nonebot import on_command, require
|
|
|
|
from nonebot.adapters.onebot.v11 import MessageSegment
|
2024-03-19 20:38:25 +08:00
|
|
|
from nonebot.params import CommandArg
|
|
|
|
from nonebot.permission import SUPERUSER
|
2024-03-20 18:27:49 +08:00
|
|
|
from nonebot.plugin import PluginMetadata
|
2024-03-19 20:38:25 +08:00
|
|
|
|
2024-05-12 02:47:14 +08:00
|
|
|
from liteyuki.utils.base.ly_typing import T_Bot, T_MessageEvent, v11
|
|
|
|
from liteyuki.utils.message.message import MarkdownMessage as md, broadcast_to_superusers
|
|
|
|
from liteyuki.utils.message.html_tool import *
|
2024-03-19 20:38:25 +08:00
|
|
|
|
2024-04-14 21:39:27 +08:00
|
|
|
md_test = on_command("mdts", permission=SUPERUSER)
|
|
|
|
btn_test = on_command("btnts", permission=SUPERUSER)
|
2024-04-17 17:45:32 +08:00
|
|
|
latex_test = on_command("latex", permission=SUPERUSER)
|
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-31 06:22:53 +08:00
|
|
|
await md.send_md(
|
2024-05-27 18:32:58 +08:00
|
|
|
v11.utils.unescape(str(arg)),
|
2024-03-19 21:56:31 +08:00
|
|
|
bot,
|
|
|
|
message_type=event.message_type,
|
|
|
|
session_id=event.user_id if event.message_type == "private" else event.group_id
|
2024-03-20 18:27:49 +08:00
|
|
|
)
|
|
|
|
|
2024-04-17 17:45:32 +08:00
|
|
|
|
2024-04-14 21:39:27 +08:00
|
|
|
@btn_test.handle()
|
|
|
|
async def _(bot: T_Bot, event: T_MessageEvent, arg: v11.Message = CommandArg()):
|
|
|
|
await md.send_btn(
|
|
|
|
str(arg),
|
|
|
|
bot,
|
|
|
|
message_type=event.message_type,
|
|
|
|
session_id=event.user_id if event.message_type == "private" else event.group_id
|
|
|
|
)
|
|
|
|
|
2024-04-17 17:45:32 +08:00
|
|
|
|
|
|
|
@latex_test.handle()
|
|
|
|
async def _(bot: T_Bot, event: T_MessageEvent, arg: v11.Message = CommandArg()):
|
2024-05-27 18:32:58 +08:00
|
|
|
latex_text = f"$${v11.utils.unescape(str(arg))}$$"
|
2024-04-17 17:45:32 +08:00
|
|
|
img = await md_to_pic(latex_text)
|
|
|
|
await bot.send(event=event, message=MessageSegment.image(img))
|
|
|
|
|
|
|
|
|
2024-03-20 18:27:49 +08:00
|
|
|
__author__ = "snowykami"
|
|
|
|
__plugin_meta__ = PluginMetadata(
|
|
|
|
name="轻雪Markdown测试",
|
|
|
|
description="用于测试Markdown的插件",
|
|
|
|
usage="",
|
|
|
|
homepage="https://github.com/snowykami/LiteyukiBot",
|
2024-03-21 14:52:02 +08:00
|
|
|
extra={
|
2024-03-22 07:44:41 +08:00
|
|
|
"liteyuki": True,
|
2024-03-21 14:52:02 +08:00
|
|
|
}
|
|
|
|
)
|