🩹 优化笨蛋检测和修复商店图标问题

This commit is contained in:
HibiKier 2025-03-02 14:27:58 +08:00
parent 98a198631e
commit 4bf5f880ba
2 changed files with 14 additions and 5 deletions

View File

@ -2,9 +2,9 @@ import os
import random
from nonebot import on_message
from nonebot.adapters import Event
from nonebot.matcher import Matcher
from nonebot.plugin import PluginMetadata
from nonebot.rule import to_me
from nonebot_plugin_alconna import UniMsg
from nonebot_plugin_session import EventSession
@ -29,7 +29,13 @@ __plugin_meta__ = PluginMetadata(
).to_dict(),
)
_matcher = on_message(rule=to_me(), priority=996, block=False)
async def rule(event: Event, message: UniMsg) -> bool:
text = message.extract_plain_text().strip()
return event.is_tome() and bool(text and len(text) < 20)
_matcher = on_message(rule=rule, priority=996, block=False)
_path = IMAGE_PATH / "_base" / "laugh"
@ -47,6 +53,8 @@ async def _(matcher: Matcher, message: UniMsg, session: EventSession):
if g.level < 0:
return
if text := message.extract_plain_text().strip():
if len(text) > 100:
return
if plugin := await PluginInfo.get_or_none(
name=text,
load_status=True,

View File

@ -492,9 +492,10 @@ class ShopManage:
for i, p in enumerate(user.props):
if prop := uuid2goods.get(p):
icon = ""
icon_path = ICON_PATH / prop.icon
if icon_path.exists():
icon = (icon_path, 33, 33)
if prop.icon:
icon_path = ICON_PATH / prop.icon
if icon_path.exists():
icon = (icon_path, 33, 33)
data_list.append(
[
icon,