mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
parent
f11e9c58e4
commit
e4a92ea34b
@ -55,7 +55,7 @@ _matcher = on_alconna(
|
||||
Subcommand("my-props", help_text="我的道具"),
|
||||
Subcommand("buy", Args["name", str]["num", int, 1], help_text="购买道具"),
|
||||
Subcommand("use", Args["name", str]["num?", int, 1], help_text="使用道具"),
|
||||
Subcommand("gold-list", Args["num?", int], help_text="使用道具"),
|
||||
Subcommand("gold-list", Args["num", int], help_text="金币排行"),
|
||||
),
|
||||
priority=5,
|
||||
block=True,
|
||||
@ -181,8 +181,14 @@ async def _(
|
||||
async def _(
|
||||
session: EventSession, arparma: Arparma, num: Query[int] = AlconnaQuery("num", 10)
|
||||
):
|
||||
if num.result > 50:
|
||||
await MessageUtils.build_message("排行榜人数不能超过50哦...").finish()
|
||||
if session.id1:
|
||||
gid = session.id3 or session.id2
|
||||
if not arparma.find("all") and not gid:
|
||||
await MessageUtils.build_message(
|
||||
"私聊中无法查看 '金币排行',请发送 '金币总排行'"
|
||||
).finish()
|
||||
if arparma.find("all"):
|
||||
gid = None
|
||||
result = await gold_rank(session.id1, gid, num.result, session.platform)
|
||||
|
||||
@ -3,9 +3,11 @@ from nonebot_plugin_session import EventSession
|
||||
from nonebot_plugin_apscheduler import scheduler
|
||||
from nonebot_plugin_alconna import (
|
||||
Args,
|
||||
Query,
|
||||
Option,
|
||||
Alconna,
|
||||
Arparma,
|
||||
AlconnaQuery,
|
||||
on_alconna,
|
||||
store_true,
|
||||
)
|
||||
@ -90,7 +92,7 @@ _sign_matcher = on_alconna(
|
||||
Option("--my", action=store_true, help_text="我的签到"),
|
||||
Option(
|
||||
"-l|--list",
|
||||
Args["num", int, 10],
|
||||
Args["num", int],
|
||||
help_text="好感度排行",
|
||||
),
|
||||
Option("-g|--global", action=store_true, help_text="全局排行"),
|
||||
@ -140,7 +142,11 @@ async def _(session: EventSession, arparma: Arparma, nickname: str = UserName())
|
||||
|
||||
|
||||
@_sign_matcher.assign("list")
|
||||
async def _(session: EventSession, arparma: Arparma, num: int):
|
||||
async def _(
|
||||
session: EventSession, arparma: Arparma, num: Query[int] = AlconnaQuery("num", 10)
|
||||
):
|
||||
if num.result > 50:
|
||||
await MessageUtils.build_message("排行榜人数不能超过50哦...").finish()
|
||||
gid = session.id3 or session.id2
|
||||
if not arparma.find("global") and not gid:
|
||||
await MessageUtils.build_message(
|
||||
@ -149,7 +155,7 @@ async def _(session: EventSession, arparma: Arparma, num: int):
|
||||
if session.id1:
|
||||
if arparma.find("global"):
|
||||
gid = None
|
||||
if image := await SignManage.rank(session.id1, num, gid):
|
||||
if image := await SignManage.rank(session.id1, num.result, gid):
|
||||
logger.info("查看签到排行", arparma.header_result, session=session)
|
||||
await MessageUtils.build_message(image).finish()
|
||||
return MessageUtils.build_message("用户id为空...").send()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user