Skip to content

Commit

Permalink
Merge pull request noneplugin#113 from jcjrobert/v0.3.x
Browse files Browse the repository at this point in the history
添加新表情"毒瘾发作"
  • Loading branch information
MeetWq authored Aug 17, 2022
2 parents bcb3de8 + a4b0f7b commit 75f9da6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions nonebot_plugin_petpet/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@
Meme("mywife", mywife, ("这是我的老婆",), r"这是(?P<ta>\S+)的(?P<name>\S+)"),
Meme("walnutpad", walnutpad, ("胡桃平板",)),
Meme("teach", teach, ("讲课", "敲黑板",)),
Meme("addition", addition, ("上瘾","毒瘾发作",)),
]
25 changes: 25 additions & 0 deletions nonebot_plugin_petpet/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,3 +1405,28 @@ def make(img: BuildImage) -> BuildImage:
)

return make_jpg_or_gif(img, make)


def addition(img: BuildImage = UserImg(), arg: str = Arg()):
frame = load_image("addiction/0.png")

if arg:
expand_frame = BuildImage.new("RGBA", (246, 286), "white")
expand_frame.paste(frame, (0, 0))
try:
expand_frame.draw_text(
(10, 246, 236, 286),
arg,
max_fontsize=45,
lines_align="center",
)
except ValueError:
return TEXT_TOO_LONG
frame = expand_frame

def make(img: BuildImage) -> BuildImage:
return frame.copy().paste(
img.resize((70, 70), keep_ratio=True), (0, 0)
)

return make_jpg_or_gif(img, make)
Binary file added resources/images/addiction/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 75f9da6

Please sign in to comment.