🐛 修复参数获取方式:改用 @filter.command 的参数注入机制
This commit is contained in:
@@ -267,13 +267,12 @@ class CFQueryPlugin(Star):
|
|||||||
|
|
||||||
# ========== 绑定 ==========
|
# ========== 绑定 ==========
|
||||||
@filter.command("cfbind")
|
@filter.command("cfbind")
|
||||||
async def cf_bind(self, event: AstrMessageEvent):
|
async def cf_bind(self, event: AstrMessageEvent, handle: str = None):
|
||||||
"""绑定CF账号:cfbind <用户名>"""
|
"""绑定CF账号:cfbind <用户名>"""
|
||||||
args = event.get_args()
|
if not handle:
|
||||||
if not args:
|
|
||||||
yield event.plain_result("❌ 用法: cfbind <CF用户名>")
|
yield event.plain_result("❌ 用法: cfbind <CF用户名>")
|
||||||
return
|
return
|
||||||
handle = args[0].strip()
|
handle = handle.strip()
|
||||||
info = _query_user_info(handle)
|
info = _query_user_info(handle)
|
||||||
if not info:
|
if not info:
|
||||||
yield event.plain_result(f"❌ CF用户 {handle} 不存在,请检查用户名")
|
yield event.plain_result(f"❌ CF用户 {handle} 不存在,请检查用户名")
|
||||||
@@ -338,13 +337,9 @@ class CFQueryPlugin(Star):
|
|||||||
|
|
||||||
# ========== 主查询 ==========
|
# ========== 主查询 ==========
|
||||||
@filter.command("cf")
|
@filter.command("cf")
|
||||||
async def cf_query(self, event: AstrMessageEvent):
|
async def cf_query(self, event: AstrMessageEvent, handle: str = None):
|
||||||
"""查询CF用户:cf <用户名> 或 cf(查已绑定)"""
|
"""查询CF用户:cf <用户名> 或 cf(查已绑定)"""
|
||||||
args = event.get_args()
|
if not handle:
|
||||||
handle = None
|
|
||||||
if args:
|
|
||||||
handle = args[0].strip()
|
|
||||||
else:
|
|
||||||
uid = str(event.get_sender_id())
|
uid = str(event.get_sender_id())
|
||||||
bindings = _load_bindings()
|
bindings = _load_bindings()
|
||||||
if uid in bindings:
|
if uid in bindings:
|
||||||
|
|||||||
Reference in New Issue
Block a user