forked from mttu-developers/konabot
十猫
This commit is contained in:
BIN
assets/img/meme/tententen.png
Normal file
BIN
assets/img/meme/tententen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 614 KiB |
@ -3,7 +3,9 @@ from io import BytesIO
|
|||||||
from nonebot_plugin_alconna import (Alconna, Args, Field, MultiVar, UniMessage,
|
from nonebot_plugin_alconna import (Alconna, Args, Field, MultiVar, UniMessage,
|
||||||
on_alconna)
|
on_alconna)
|
||||||
|
|
||||||
from konabot.plugins.memepack.drawing.saying import draw_geimao, draw_mnk, draw_pt, draw_suan
|
from konabot.plugins.memepack.drawing.saying import (draw_cute_ten,
|
||||||
|
draw_geimao, draw_mnk,
|
||||||
|
draw_pt, draw_suan)
|
||||||
|
|
||||||
geimao = on_alconna(Alconna(
|
geimao = on_alconna(Alconna(
|
||||||
"给猫说",
|
"给猫说",
|
||||||
@ -83,3 +85,19 @@ async def _(saying: list[str]):
|
|||||||
img.save(img_bytes, format="PNG")
|
img.save(img_bytes, format="PNG")
|
||||||
|
|
||||||
await pt.send(await UniMessage().image(raw=img_bytes).export())
|
await pt.send(await UniMessage().image(raw=img_bytes).export())
|
||||||
|
|
||||||
|
|
||||||
|
dsuan = on_alconna(Alconna(
|
||||||
|
"乖猫说",
|
||||||
|
Args["saying", MultiVar(str, '+'), Field(
|
||||||
|
missing_tips=lambda: "你没有写十猫说了什么"
|
||||||
|
)]
|
||||||
|
), use_cmd_start=True, use_cmd_sep=False, skip_for_unmatch=False, aliases={"十猫说"})
|
||||||
|
|
||||||
|
@dsuan.handle()
|
||||||
|
async def _(saying: list[str]):
|
||||||
|
img = await draw_cute_ten("\n".join(saying))
|
||||||
|
img_bytes = BytesIO()
|
||||||
|
img.save(img_bytes, format="PNG")
|
||||||
|
|
||||||
|
await pt.send(await UniMessage().image(raw=img_bytes).export())
|
||||||
|
|||||||
@ -13,6 +13,7 @@ pt_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "ptsay.png").convert("R
|
|||||||
mnk_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "mnksay.jpg").convert("RGBA")
|
mnk_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "mnksay.jpg").convert("RGBA")
|
||||||
dasuan_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "dss.png").convert("RGBA")
|
dasuan_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "dss.png").convert("RGBA")
|
||||||
suan_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "suanleba.png").convert("RGBA")
|
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")
|
||||||
|
|
||||||
|
|
||||||
def _draw_geimao(saying: str):
|
def _draw_geimao(saying: str):
|
||||||
@ -88,3 +89,20 @@ def _draw_suan(saying: str, dasuan: bool = False):
|
|||||||
|
|
||||||
async def draw_suan(saying: str, dasuan: bool = False):
|
async def draw_suan(saying: str, dasuan: bool = False):
|
||||||
return await asyncio.to_thread(_draw_suan, saying, dasuan)
|
return await asyncio.to_thread(_draw_suan, saying, dasuan)
|
||||||
|
|
||||||
|
|
||||||
|
def _draw_cute_ten(saying: str):
|
||||||
|
img = cute_ten_image.copy()
|
||||||
|
with imagetext_py.Writer(img) as iw:
|
||||||
|
iw.draw_text_wrapped(
|
||||||
|
saying, 390, 479, 0.5, 0.5, 760, 96, LXGWWENKAI_REGULAR,
|
||||||
|
imagetext_py.Paint.Color(imagetext_py.Color.from_hex("000000FF")),
|
||||||
|
1.0,
|
||||||
|
imagetext_py.TextAlign.Center,
|
||||||
|
draw_emojis=True,
|
||||||
|
)
|
||||||
|
return img
|
||||||
|
|
||||||
|
|
||||||
|
async def draw_cute_ten(saying: str):
|
||||||
|
return await asyncio.to_thread(_draw_cute_ten, saying)
|
||||||
|
|||||||
Reference in New Issue
Block a user