mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
⚡️ 修复私聊ban后群组中回复不正确
This commit is contained in:
parent
278a5319a4
commit
50d8059e9f
@ -2,6 +2,7 @@ import os
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
from nonebot import on_message
|
from nonebot import on_message
|
||||||
|
from nonebot.matcher import Matcher
|
||||||
from nonebot.plugin import PluginMetadata
|
from nonebot.plugin import PluginMetadata
|
||||||
from nonebot.rule import to_me
|
from nonebot.rule import to_me
|
||||||
from nonebot_plugin_alconna import Image, UniMessage, UniMsg
|
from nonebot_plugin_alconna import Image, UniMessage, UniMsg
|
||||||
@ -32,7 +33,7 @@ _path = IMAGE_PATH / "_base" / "laugh"
|
|||||||
|
|
||||||
|
|
||||||
@_matcher.handle()
|
@_matcher.handle()
|
||||||
async def _(message: UniMsg, session: EventSession):
|
async def _(matcher: Matcher, message: UniMsg, session: EventSession):
|
||||||
if text := message.extract_plain_text().strip():
|
if text := message.extract_plain_text().strip():
|
||||||
if plugin := await PluginInfo.get_or_none(
|
if plugin := await PluginInfo.get_or_none(
|
||||||
name=text, load_status=True, plugin_type=PluginType.NORMAL
|
name=text, load_status=True, plugin_type=PluginType.NORMAL
|
||||||
@ -50,4 +51,5 @@ async def _(message: UniMsg, session: EventSession):
|
|||||||
logger.info(
|
logger.info(
|
||||||
f"检测到功能名称当命令使用,已发送帮助信息", "功能帮助", session=session
|
f"检测到功能名称当命令使用,已发送帮助信息", "功能帮助", session=session
|
||||||
)
|
)
|
||||||
await UniMessage(message_list).finish(reply_to=True)
|
await UniMessage(message_list).send(reply_to=True)
|
||||||
|
matcher.stop_propagation()
|
||||||
|
|||||||
@ -206,9 +206,9 @@ class AuthChecker:
|
|||||||
if not group_id:
|
if not group_id:
|
||||||
group_id = channel_id
|
group_id = channel_id
|
||||||
channel_id = None
|
channel_id = None
|
||||||
if user_id and matcher.plugin and (module := matcher.plugin.name):
|
if user_id and matcher.plugin and (module_path := matcher.plugin.module_name):
|
||||||
user = await UserConsole.get_user(user_id, session.platform)
|
user = await UserConsole.get_user(user_id, session.platform)
|
||||||
if plugin := await PluginInfo.get_or_none(module=module):
|
if plugin := await PluginInfo.get_or_none(module_path=module_path):
|
||||||
if plugin.plugin_type == PluginType.HIDDEN:
|
if plugin.plugin_type == PluginType.HIDDEN:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -93,6 +93,8 @@ class BanConsole(Model):
|
|||||||
"""
|
"""
|
||||||
logger.debug(f"获取用户ban时长", target=f"{group_id}:{user_id}")
|
logger.debug(f"获取用户ban时长", target=f"{group_id}:{user_id}")
|
||||||
user = await cls._get_data(user_id, group_id)
|
user = await cls._get_data(user_id, group_id)
|
||||||
|
if not user and user_id:
|
||||||
|
user = await cls._get_data(user_id, None)
|
||||||
if user:
|
if user:
|
||||||
if user.duration == -1:
|
if user.duration == -1:
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user