From 44fa56450808e38f29b61a6b2e736698eaa76941 Mon Sep 17 00:00:00 2001 From: SlyAimer <2289782085@qq.com> Date: Thu, 13 Feb 2025 21:57:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(plugins/good=5Fbad=5Fnews.py):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=BE=93=E5=85=A5=E6=A0=BC=E5=BC=8F=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整代码结构,将变量赋值移至输入验证之后,避免潜在错误。 --- src/plugins/good_bad_news.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/good_bad_news.py b/src/plugins/good_bad_news.py index 1c93bb6..c36c497 100644 --- a/src/plugins/good_bad_news.py +++ b/src/plugins/good_bad_news.py @@ -44,9 +44,9 @@ good_news = on_command("喜报", rule=to_me(), priority=10, block=True, aliases= async def function(message: MessageEvent): value = message.get_plaintext().split(" ") filename = "" - keyword,content = value[0], value[1] if len(value) < 2 or len(value) > 2: await good_news.finish("请输入 正确的格式哦~ /喜报+内容 或者 /悲报+内容") + keyword, content = value[0], value[1] if keyword == "/喜报": filename = "good_news.png" await add_text_to_image(image_path=good_bad + filename, output_path=temp_path + filename, content=content,