This commit is contained in:
BIN
assets/img/meme/vr.jpg
Executable file
BIN
assets/img/meme/vr.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
@ -34,6 +34,7 @@ from konabot.plugins.memepack.drawing.saying import (
|
||||
draw_mnk,
|
||||
draw_pt,
|
||||
draw_suan,
|
||||
draw_vr,
|
||||
)
|
||||
from konabot.plugins.memepack.drawing.watermark import draw_doubao_watermark
|
||||
|
||||
@ -334,3 +335,29 @@ async def _(img: DepPILImage):
|
||||
result_bytes = BytesIO()
|
||||
result.save(result_bytes, format="PNG")
|
||||
await doubao_cmd.send(await UniMessage().image(raw=result_bytes).export())
|
||||
|
||||
|
||||
vrsay = on_alconna(
|
||||
Alconna(
|
||||
"vr说",
|
||||
Args[
|
||||
"saying",
|
||||
MultiVar(str, "+"),
|
||||
Field(missing_tips=lambda: "你没有写vr说了什么"),
|
||||
],
|
||||
),
|
||||
use_cmd_start=True,
|
||||
use_cmd_sep=False,
|
||||
skip_for_unmatch=False,
|
||||
aliases=set(),
|
||||
)
|
||||
|
||||
|
||||
@vrsay.handle()
|
||||
async def _(saying: list[str]):
|
||||
img = await draw_vr("\n".join(saying))
|
||||
img_bytes = BytesIO()
|
||||
img.save(img_bytes, format="PNG")
|
||||
|
||||
await vrsay.send(await UniMessage().image(raw=img_bytes).export())
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ dasuan_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "dss.png").convert(
|
||||
suan_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "suanleba.png").convert("RGBA")
|
||||
cute_ten_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "tententen.png").convert("RGBA")
|
||||
kio_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "kiosay.jpg").convert("RGBA")
|
||||
vr_image = PIL.Image.open(ASSETS_PATH / 'img' / 'meme' / 'vr.jpg').convert("RGBA")
|
||||
|
||||
|
||||
def _draw_geimao(saying: str):
|
||||
@ -123,3 +124,24 @@ def draw_kiosay(saying: str):
|
||||
)
|
||||
return img
|
||||
|
||||
|
||||
@make_async
|
||||
def draw_vr(saying: str):
|
||||
img = vr_image.copy()
|
||||
w, h = img.size
|
||||
hw = 300
|
||||
|
||||
img2 = PIL.Image.new("RGBA", (w, h + hw), 'white')
|
||||
img2.paste(img, (0, hw))
|
||||
|
||||
with imagetext_py.Writer(img2) as iw:
|
||||
iw.draw_text_wrapped(
|
||||
saying, w // 2, hw // 2 + 15, 0.5, 0.5, w, 64, LXGWWENKAI_REGULAR,
|
||||
imagetext_py.Paint.Color(imagetext_py.Color.from_hex("000000FF")),
|
||||
1.0,
|
||||
imagetext_py.TextAlign.Center,
|
||||
draw_emojis=True,
|
||||
)
|
||||
|
||||
return img2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user