Skip to content

Commit

Permalink
adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed Aug 15, 2024
1 parent 34d4141 commit d4cd937
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
18 changes: 3 additions & 15 deletions nonebot_plugin_memes/matchers/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

from arclet.alconna import config as alc_config
from meme_generator import Meme
from meme_generator.exception import (
ArgMismatch,
MemeGeneratorException,
TextOrNameNotEnough,
TextOverLength,
)
from meme_generator.exception import MemeGeneratorException
from nonebot.adapters import Bot, Event
from nonebot.compat import PYDANTIC_V2, ConfigDict
from nonebot.exception import AdapterException
Expand Down Expand Up @@ -75,15 +70,8 @@ async def process(
try:
result = await run_sync(meme)(images=images, texts=texts, args=args)
await record_meme_generation(session, meme.key)
except TextOverLength:
await matcher.finish("文字长度过长")
except ArgMismatch:
await matcher.finish("参数解析错误")
except TextOrNameNotEnough:
await matcher.finish("文字或名字数量不足")
except MemeGeneratorException:
logger.warning(traceback.format_exc())
await matcher.finish("出错了,请稍后再试")
except MemeGeneratorException as e:
await matcher.finish(e.message)

msg = UniMessage()
if show_info:
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_memes/matchers/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ def fmt_time(time: datetime) -> str:
)
output = await plot_duration_counts(duration_counts, title)
else:
title = f"{humanized}表情调用统计"
title = f"{humanized}表情调用统计(总调用次数为 {sum(key_counts.values())}"
output = await plot_key_and_duration_counts(key_counts, duration_counts, title)
await UniMessage.image(raw=output).send()
30 changes: 15 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot_plugin_memes"
version = "0.7.5"
version = "0.7.6"
description = "Nonebot2 plugin for making memes"
authors = ["meetwq <[email protected]>"]
license = "MIT"
Expand All @@ -18,7 +18,7 @@ nonebot-plugin-localstore = ">=0.6.0,<1.0.0"
nonebot-plugin-orm = ">=0.7.0,<1.0.0"
nonebot-plugin-session-orm = "^0.2.0"
httpx = ">=0.20.0,<1.0.0"
meme-generator = "^0.1.0"
meme-generator = "^0.1.1"
pypinyin = ">=0.44.0,<1.0.0"
pyyaml = "^6.0"
rapidfuzz = "^3.9.0"
Expand Down

0 comments on commit d4cd937

Please sign in to comment.