From dfbb7f347eb7a6b07f67cebde0651601c77fdd24 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Mon, 5 Aug 2024 21:29:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=87=91=E5=B8=81=E7=BA=A2=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/plugins/gold_redbag/__init__.py | 17 +++++++++-------- zhenxun/plugins/russian/__init__.py | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/zhenxun/plugins/gold_redbag/__init__.py b/zhenxun/plugins/gold_redbag/__init__.py index a24a5fb5..bb8feef7 100644 --- a/zhenxun/plugins/gold_redbag/__init__.py +++ b/zhenxun/plugins/gold_redbag/__init__.py @@ -1,7 +1,6 @@ import time import uuid from datetime import datetime, timedelta -from typing import List from apscheduler.jobstores.base import JobLookupError from nonebot.adapters import Bot @@ -44,7 +43,7 @@ __plugin_meta__ = PluginMetadata( author="HibiKier", version="0.1", superuser_help=""" - 节日红包 [金额] [红包数] ?[指定主题文字] ? -g [群id] + 节日红包 [金额] [红包数] ?[指定主题文字] ? -g [群id] [群id] ... * 不同群组同一个节日红包用户只能开一次 @@ -116,7 +115,7 @@ _festive_matcher = on_alconna( Alconna( "节日红包", Args["amount", int]["num", int]["text?", str], - Option("-g|--group", Args["group_list", str], help_text="指定群"), + Option("-g|--group", Args["groups", str] / "\n", help_text="指定群"), ), priority=1, block=True, @@ -275,25 +274,24 @@ async def _( async def _( bot: Bot, session: EventSession, - arparma: Arparma, amount: int, num: int, text: Match[str], - group_list: Match[str], - user_name: str = UserName(), + groups: Match[str], ): # TODO: 指定多个群 greetings = "恭喜发财 大吉大利" if text.available: greetings = text.result gl = [] - if group_list.available: - gl = [group_list.result] + if groups.available: + gl = groups.result.strip().split() else: g_l, platform = await PlatformUtils.get_group_list(bot) gl = [g.channel_id or g.group_id for g in g_l] _uuid = str(uuid.uuid1()) FestiveRedBagManage.add(_uuid) + _suc_cnt = 0 for g in gl: if target := PlatformUtils.get_target(bot, group_id=g): group_red_bag = RedBagManager.get_group_data(g) @@ -350,6 +348,9 @@ async def _( Image(image_result.pic2bytes()), ] ).send_to(target=target, bot=bot) + _suc_cnt += 1 logger.debug("节日红包图片信息发送成功...", "节日红包", group_id=g) except ActionFailed: logger.warning(f"节日红包图片信息发送失败...", "节日红包", group_id=g) + if gl: + await Text(f"节日红包发送成功,累计成功发送 {_suc_cnt} 个群组!").send() diff --git a/zhenxun/plugins/russian/__init__.py b/zhenxun/plugins/russian/__init__.py index aa2559ef..ea4a5ac0 100644 --- a/zhenxun/plugins/russian/__init__.py +++ b/zhenxun/plugins/russian/__init__.py @@ -35,7 +35,7 @@ __plugin_meta__ = PluginMetadata( 结算: 强行结束当前比赛 (仅当一方未开枪超过30秒时可使用) 我的战绩: 对,你的战绩 轮盘胜场排行/轮盘败场排行/轮盘欧洲人排行/轮盘慈善家排行/轮盘最高连胜排行/轮盘最高连败排行: 各种排行榜 - 示例:装弹 3 100 @sdd + 示例:装弹 100 3 @sdd * 注:同一时间群内只能有一场对决 * """.strip(), extra=PluginExtraData(