更新插件俄罗斯轮盘 (#1585)

This commit is contained in:
xuanerwa 2024-08-27 15:17:42 +08:00 committed by GitHub
parent 61ab7ef3d3
commit 72641c7983
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -28,14 +28,14 @@ __plugin_meta__ = PluginMetadata(
usage="""
又到了决斗时刻
指令
装弹 [金额] [子弹数] ?[at]: 开启游戏装填子弹可选自定义金额或邀请决斗对象
装弹 [子弹数] ?[金额] ?[at]: 开启游戏装填子弹可选自定义金额或邀请决斗对象
接受对决: 接受当前存在的对决
拒绝对决: 拒绝邀请的对决
开枪: 开出未知的一枪
结算: 强行结束当前比赛 (仅当一方未开枪超过30秒时可使用)
我的战绩: 你的战绩
轮盘胜场排行/轮盘败场排行/轮盘欧洲人排行/轮盘慈善家排行/轮盘最高连胜排行/轮盘最高连败排行: 各种排行榜
示例装弹 100 3 @sdd
示例装弹 3 100 @sdd
* 同一时间群内只能有一场对决 *
""".strip(),
extra=PluginExtraData(
@ -56,10 +56,11 @@ __plugin_meta__ = PluginMetadata(
@_russian_matcher.handle()
async def _(money: int, num: Match[str], at_user: Match[alcAt]):
_russian_matcher.set_path_arg("money", money)
async def _(num: Match[str], money: Match[int], at_user: Match[alcAt]):
if num.available:
_russian_matcher.set_path_arg("num", num.result)
if money.available:
_russian_matcher.set_path_arg("money", money.result)
if at_user.available:
_russian_matcher.set_path_arg("at_user", at_user.result.target)
@ -72,8 +73,8 @@ async def _(
session: EventSession,
message: UniMsg,
arparma: Arparma,
money: int,
num: str,
money: Match[int],
at_user: Match[alcAt],
uname: str = UserName(),
):
@ -84,8 +85,7 @@ async def _(
await MessageUtils.build_message("用户id为空...").finish()
if not gid:
await MessageUtils.build_message("群组id为空...").finish()
if money <= 0:
await MessageUtils.build_message("赌注金额必须大于0!").finish(reply_to=True)
money = money.result if money.available else 200
if num in ["取消", "算了"]:
await MessageUtils.build_message("已取消装弹...").finish()
if not num.isdigit():

View File

@ -7,7 +7,7 @@ from zhenxun.utils.rules import ensure_group
_russian_matcher = on_alconna(
Alconna(
"俄罗斯轮盘",
Args["money", int]["num?", str]["at_user?", alcAt],
Args["num?", str]["money?", int]["at_user?", alcAt],
),
aliases={"装弹", "俄罗斯转盘"},
rule=ensure_group,