Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ 更新插件俄罗斯轮盘 #1585

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions zhenxun/plugins/russian/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
usage="""
又到了决斗时刻
指令:
装弹 [金额] [子弹数] ?[at]: 开启游戏,装填子弹,可选自定义金额,或邀请决斗对象
装弹 [子弹数] ?[金额] ?[at]: 开启游戏,装填子弹,可选自定义金额,或邀请决斗对象
接受对决: 接受当前存在的对决
拒绝对决: 拒绝邀请的对决
开枪: 开出未知的一枪
结算: 强行结束当前比赛 (仅当一方未开枪超过30秒时可使用)
我的战绩: 对,你的战绩
轮盘胜场排行/轮盘败场排行/轮盘欧洲人排行/轮盘慈善家排行/轮盘最高连胜排行/轮盘最高连败排行: 各种排行榜
示例:装弹 100 3 @sdd
示例:装弹 3 100 @sdd
* 注:同一时间群内只能有一场对决 *
""".strip(),
extra=PluginExtraData(
Expand All @@ -56,10 +56,11 @@


@_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)

Expand All @@ -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(),
):
Expand All @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion zhenxun/plugins/russian/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_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,
Expand Down
Loading