mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
🐛 统一被动技能判断
This commit is contained in:
parent
7ab800be97
commit
131cd5ea9a
@ -26,6 +26,7 @@ from zhenxun.models.group_console import GroupConsole
|
||||
from zhenxun.models.group_member_info import GroupInfoUser
|
||||
from zhenxun.models.level_user import LevelUser
|
||||
from zhenxun.models.plugin_info import PluginInfo
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType, RequestHandleType
|
||||
from zhenxun.utils.utils import FreqLimiter
|
||||
@ -240,7 +241,7 @@ async def _(bot: Bot, event: GroupIncreaseNoticeEvent | GroupMemberIncreaseEvent
|
||||
img_file = path / f"{i}.png"
|
||||
if img_file.exists():
|
||||
msg_list.append(Image(img_file))
|
||||
if not GroupConsole.is_block_task(group_id, "group_welcome"):
|
||||
if not TaskInfo.is_block("group_welcome", group_id):
|
||||
logger.info(f"发送群欢迎消息...", "入群检测", group_id=group_id)
|
||||
if msg_list:
|
||||
await MessageFactory(msg_list).send()
|
||||
@ -311,5 +312,5 @@ async def _(bot: Bot, event: GroupDecreaseNoticeEvent | GroupMemberDecreaseEvent
|
||||
)
|
||||
operator_name = operator["card"] if operator["card"] else operator["nickname"]
|
||||
result = f"{user_name} 被 {operator_name} 送走了."
|
||||
if not GroupConsole.is_block_task(str(event.group_id), "refund_group_remind"):
|
||||
if not TaskInfo.is_block("refund_group_remind", str(event.group_id)):
|
||||
await group_decrease_handle.send(f"{result}")
|
||||
|
||||
@ -40,11 +40,8 @@ async def _():
|
||||
)
|
||||
|
||||
|
||||
async def check(group_id: str, channel_id: str | None) -> bool:
|
||||
task = await TaskInfo.get_or_none(module="morning_goodnight")
|
||||
if not task or not task.status:
|
||||
return False
|
||||
return await GroupConsole.is_block_task(group_id, "morning_goodnight")
|
||||
async def check(group_id: str) -> bool:
|
||||
return not await TaskInfo.is_block("morning_goodnight", group_id)
|
||||
|
||||
|
||||
# 早上好
|
||||
|
||||
@ -10,6 +10,7 @@ from nonebot_plugin_saa import Image, MessageFactory, Text
|
||||
from nonebot_plugin_session import EventSession
|
||||
|
||||
from zhenxun.models.group_console import GroupConsole
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.platform import PlatformUtils
|
||||
|
||||
@ -41,8 +42,9 @@ class BroadcastManage:
|
||||
error_count = 0
|
||||
for group in group_list:
|
||||
try:
|
||||
if not await GroupConsole.is_block_task(
|
||||
group.group_id, "broadcast", group.channel_id
|
||||
if not await TaskInfo.is_block(
|
||||
group.group_id,
|
||||
"broadcast", # group.channel_id
|
||||
):
|
||||
target = PlatformUtils.get_target(
|
||||
bot, None, group.channel_id or group.group_id
|
||||
|
||||
@ -12,10 +12,8 @@ from zhenxun.configs.config import NICKNAME, Config
|
||||
from zhenxun.configs.path_config import TEMP_PATH
|
||||
from zhenxun.configs.utils import PluginExtraData, RegisterConfig, Task
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.enum import PluginType
|
||||
from zhenxun.utils.http_utils import AsyncHttpx
|
||||
from zhenxun.utils.image_utils import get_download_image_hash, get_img_hash
|
||||
from zhenxun.utils.image_utils import get_download_image_hash
|
||||
from zhenxun.utils.rules import ensure_group
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
@ -98,12 +96,11 @@ _matcher = on_message(rule=ensure_group, priority=999)
|
||||
|
||||
@_matcher.handle()
|
||||
async def _(message: UniMsg, event: Event, session: EventSession):
|
||||
task = await TaskInfo.get_or_none(module="fudu")
|
||||
if task and not task.status:
|
||||
group_id = session.id2 or ""
|
||||
if await TaskInfo.is_block("fudu", group_id):
|
||||
return
|
||||
if event.is_tome():
|
||||
return
|
||||
group_id = session.id2 or ""
|
||||
plain_text = message.extract_plain_text()
|
||||
image_list = []
|
||||
for m in message:
|
||||
|
||||
@ -45,13 +45,7 @@ __plugin_meta__ = PluginMetadata(
|
||||
|
||||
|
||||
async def _rule(session: EventSession) -> bool:
|
||||
task = await TaskInfo.get_or_none(module="bilibili_parse")
|
||||
if not task or not task.status:
|
||||
logger.debug("b站转发解析被动全局关闭,已跳过...")
|
||||
return False
|
||||
if gid := session.id3 or session.id2:
|
||||
return not await GroupConsole.is_block_task(gid, "bilibili_parse")
|
||||
return False
|
||||
return not TaskInfo.is_block("bilibili_parse", session.id3 or session.id2)
|
||||
|
||||
|
||||
_matcher = on_message(priority=1, block=False, rule=_rule)
|
||||
|
||||
@ -560,7 +560,7 @@ async def broadcast_group(
|
||||
bot: Bot | list[Bot] | None = None,
|
||||
bot_id: str | Set[str] | None = None,
|
||||
ignore_group: Set[int] | None = None,
|
||||
check_func: Callable[[str, str | None], Awaitable] | None = None,
|
||||
check_func: Callable[[str], Awaitable] | None = None,
|
||||
log_cmd: str | None = None,
|
||||
platform: Literal["qq", "dodo", "kaiheila"] | None = None,
|
||||
):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user