mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-15 09:10:00 +08:00
使用check构造的problem而不在message_handle中重新构造
This commit is contained in:
@@ -3,6 +3,7 @@ from PIL import Image
|
||||
from io import BytesIO
|
||||
from httpx import TimeoutException
|
||||
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters.onebot.v11 import MessageEvent
|
||||
|
||||
from utils.utils import get_message_text, get_message_img, get_message_at
|
||||
@@ -10,7 +11,7 @@ from ._model import WordBank
|
||||
from utils.http_utils import AsyncHttpx
|
||||
|
||||
|
||||
async def check(event: MessageEvent) -> bool:
|
||||
async def check(event: MessageEvent, state: T_State) -> bool:
|
||||
text = get_message_text(event.message)
|
||||
img = get_message_img(event.message)
|
||||
at = get_message_at(event.message)
|
||||
@@ -31,6 +32,7 @@ async def check(event: MessageEvent) -> bool:
|
||||
elif seg.type == 'text':
|
||||
temp += seg.data["text"]
|
||||
problem = temp
|
||||
if problem:
|
||||
return await WordBank.check(event, problem) is not None
|
||||
if problem and (await WordBank.check(event, problem) is not None):
|
||||
state["problem"] = problem
|
||||
return True
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user