文件夹结构

This commit is contained in:
alcoholicgirl
2026-04-25 01:59:29 +08:00
parent 3bf0735af4
commit 81e0c05686
10 changed files with 24 additions and 26 deletions

View File

@ -0,0 +1,15 @@
from nonebot import on_command
from nonebot.adapters import Message
from nonebot_plugin_alconna import UniMessage
from nonebot.params import CommandArg
import render
import io
cmd_marchtoy = on_command("march", priority=10, block=True)
@cmd_marchtoy.handle()
async def _(args: Message = CommandArg()):
if cmd := args.extract_plain_text():
img = await render.render(cmd, 256, 256)
buffer = io.BytesIO()
img.save(buffer, format="PNG")
buffer.seek(0)
await cmd_marchtoy.send(await UniMessage().image(raw=buffer).export())

View File

@ -18,8 +18,8 @@ from dataclasses import dataclass
import re
import numpy as np
from dataclasses import dataclass
from obj import Object, Camera, OBJECT_ENTRIES
from op import OPERATION_ENTRIES
from konabot.plugins.marchtoy.obj import Object, Camera, OBJECT_ENTRIES
from konabot.plugins.marchtoy.op import OPERATION_ENTRIES
from typing import Optional
@dataclass

View File

@ -1,6 +1,6 @@
import numpy as np
from texture import Texture
from utilities import ArgParser, SkslFormatter
from konabot.plugins.marchtoy.texture import Texture
from konabot.plugins.marchtoy.utilities import ArgParser, SkslFormatter
OBJECT_ENTRIES = {}

View File

@ -1,6 +1,6 @@
from obj import Object
from konabot.plugins.marchtoy.obj import Object
import numpy as np
from utilities import ArgParser
from konabot.plugins.marchtoy.utilities import ArgParser
OPERATION_ENTRIES = {}

View File

@ -1,4 +1,4 @@
from command import Scene
from konabot.plugins.marchtoy.command import Scene
import skia
import struct
from PIL import Image

View File

@ -1,5 +1,5 @@
import numpy as np
from texture import COLORS
from konabot.plugins.marchtoy.texture import COLORS
class SkslFormatter:

View File

@ -2,11 +2,6 @@ from nonebot_plugin_alconna import Alconna, Args, Option, UniMessage, on_alconna
from konabot.common.nb.exc import BotExceptionMessage
from konabot.plugins.sksl.run_sksl import render_sksl_shader_to_gif
from nonebot import on_command
from nonebot.adapters import Bot, Event, Message
from nonebot.params import CommandArg
import marchtoy
import io
cmd_run_sksl = on_alconna(
Alconna(
@ -49,15 +44,4 @@ async def _(
except (ValueError, RuntimeError) as e:
await cmd_run_sksl.send(
await UniMessage().text(f"渲染时遇到了问题:\n\n{e}").export()
)
cmd_marchtoy = on_command("march", priority=10, block=True)
@cmd_marchtoy.handle()
async def _(args: Message = CommandArg()):
if cmd := args.extract_plain_text():
img = await marchtoy.render.render(cmd, 256, 256)
buffer = io.BytesIO()
img.save(buffer, format="PNG")
buffer.seek(0)
await cmd_run_sksl.send(await UniMessage().image(raw=buffer).export())
)

View File

@ -1 +0,0 @@
import render