feat(ban): 在调用ban列表时主动删除过期数据 (#1997)

* feat(ban): 在调用ban列表时主动删除过期数据
- 除了接收到被ban用户的信息外,现在主动调用`ban列表`命令也会删除过期数据
- 修复 unban 返回信息错误

* refactor(ban): 优化 unban 函数返回值逻辑

- 使用或运算简化返回值判断逻辑
- 移除不必要的字符串转换

* refactor(zhenxun): 优化 unban 函数返回值类型

- 将 unban 函数的返回类型从 tuple[bool, str | None] 改为 tuple[bool, str]
- 修改返回值,确保总是返回字符串类型,避免类型检查错误
This commit is contained in:
molanp
2025-08-05 19:12:15 +08:00
committed by GitHub
parent 7719be9866
commit 872d2499a2
2 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ class BanConsole(Model):
return -1
_time = time.time() - (user.ban_time + user.duration)
if _time < 0:
return int(time.time() - user.ban_time - user.duration)
return int(abs(_time))
await user.delete()
return 0