mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
🐛 修复缓存类型声明,优化封禁用户处理逻辑
This commit is contained in:
parent
bb4dde7511
commit
be85a03788
@ -29,15 +29,15 @@ Config.add_plugin_config(
|
||||
async def is_ban(user_id: str | None, group_id: str | None) -> int:
|
||||
if not user_id and not group_id:
|
||||
return 0
|
||||
cache = Cache[list[BanConsole]](CacheType.BAN)
|
||||
cache = Cache[BanConsole](CacheType.BAN)
|
||||
group_user, user = await asyncio.gather(
|
||||
cache.get(user_id, group_id), cache.get(user_id)
|
||||
)
|
||||
results = []
|
||||
if group_user:
|
||||
results.extend(group_user)
|
||||
results.append(group_user)
|
||||
if user:
|
||||
results.extend(user)
|
||||
results.append(user)
|
||||
if not results:
|
||||
return 0
|
||||
for result in results:
|
||||
|
||||
@ -154,7 +154,7 @@ async def _():
|
||||
return {f"{d.group_id or ''}:{d.user_id or ''}": d for d in data_list}
|
||||
|
||||
|
||||
@CacheRoot.getter(CacheType.BAN, result_model=list[BanConsole])
|
||||
@CacheRoot.getter(CacheType.BAN, result_model=BanConsole)
|
||||
async def _(cache_data: CacheData, user_id: str | None, group_id: str | None = None):
|
||||
"""获取封禁缓存"""
|
||||
if not user_id and not group_id:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user