mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
⚡️ 修复bug
This commit is contained in:
parent
b20f748b4f
commit
4cb350a003
@ -116,8 +116,6 @@ class BanConsole(Model):
|
||||
if await cls.check_ban_time(user_id, group_id):
|
||||
return True
|
||||
else:
|
||||
if await cls.check_ban_time(user_id, group_id):
|
||||
return True
|
||||
await cls.unban(user_id, group_id)
|
||||
return False
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ from tortoise import fields
|
||||
|
||||
from zhenxun.services.db_context import Model
|
||||
|
||||
from .ban_console import BanConsole
|
||||
from .group_console import GroupConsole
|
||||
|
||||
|
||||
@ -25,18 +26,30 @@ class TaskInfo(Model):
|
||||
|
||||
@classmethod
|
||||
async def is_block(cls, module: str, group_id: str | None) -> bool:
|
||||
"""判断被动技能是否被禁用
|
||||
"""判断被动技能是否可以发送
|
||||
|
||||
参数:
|
||||
module: 被动技能模块名
|
||||
group_id: 群组id
|
||||
|
||||
返回:
|
||||
bool: 是否被禁用
|
||||
bool: 是否可以发送
|
||||
"""
|
||||
if task := await cls.get_or_none(module=module):
|
||||
"""被动全局状态"""
|
||||
if not task.status:
|
||||
return True
|
||||
if group_id:
|
||||
return await GroupConsole.is_block_task(group_id, module)
|
||||
if await GroupConsole.is_block_task(group_id, module):
|
||||
"""群组是否禁用被动"""
|
||||
return True
|
||||
if g := await GroupConsole.get_or_none(
|
||||
group_id=group_id, channel_id__isnull=True
|
||||
):
|
||||
"""群组权限是否小于0"""
|
||||
if g.level < 0:
|
||||
return True
|
||||
if await BanConsole.is_ban(None, group_id):
|
||||
"""群组是否被ban"""
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -10,7 +10,6 @@ from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.configs.path_config import TEMP_PATH
|
||||
from zhenxun.configs.utils import PluginExtraData, RegisterConfig, Task
|
||||
from zhenxun.models.group_console import GroupConsole
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.http_utils import AsyncHttpx
|
||||
@ -45,7 +44,7 @@ __plugin_meta__ = PluginMetadata(
|
||||
|
||||
|
||||
async def _rule(session: EventSession) -> bool:
|
||||
return not TaskInfo.is_block("bilibili_parse", session.id3 or session.id2)
|
||||
return not await TaskInfo.is_block("bilibili_parse", session.id3 or session.id2)
|
||||
|
||||
|
||||
_matcher = on_message(priority=1, block=False, rule=_rule)
|
||||
|
||||
@ -293,7 +293,11 @@ class RussianManage:
|
||||
return result, settle
|
||||
else:
|
||||
"""存活"""
|
||||
p = (russian.bullet_index + russian.bullet_num + 1) / len(russian.bullet_arr) * 100
|
||||
p = (
|
||||
(russian.bullet_index + russian.bullet_num + 1)
|
||||
/ len(russian.bullet_arr)
|
||||
* 100
|
||||
)
|
||||
result = (
|
||||
random.choice(
|
||||
[
|
||||
|
||||
Loading…
Reference in New Issue
Block a user