Wiki新增七圣召唤图鉴

This commit is contained in:
CMHopeSunshine 2022-11-28 17:50:33 +08:00
parent 740c748a63
commit 801f06b34c
4 changed files with 14 additions and 10 deletions

View File

@ -12,7 +12,7 @@ from nonebot.typing import T_State
from LittlePaimon.database import PlayerAlias
from LittlePaimon.utils import NICKNAME
from LittlePaimon.utils.alias import get_match_alias
from LittlePaimon.utils.message import MessageBuild
from LittlePaimon.utils.message import MessageBuild, fullmatch_rule
from LittlePaimon.utils.path import RESOURCE_BASE_PATH
from LittlePaimon.utils.tool import freq_limiter
from .draw_daily_material import draw_material
@ -84,7 +84,7 @@ card_wiki = on_command('七圣召唤图鉴', aliases={'原牌图鉴', '原石传
'pm_priority': 13
})
card_wiki_list = on_command('七圣召唤列表', aliases={'七圣召唤卡牌列表', '原牌列表', '原石传说列表'}, priority=11,
block=True, state={
rule=fullmatch_rule, block=True, state={
'pm_name': '七圣召唤图鉴列表',
'pm_description': '查看七圣召唤卡牌图鉴列表',
'pm_usage': '原牌列表',

View File

@ -12,7 +12,9 @@ async def update_card_list():
with contextlib.suppress(Exception):
resp = await aiorequests.get(CARD_RESOURCES_API)
if resp.status_code == 200:
card_list.extend([card['name'].split('.')[0] for card in resp.json()])
for card in resp.json():
if (name := card['name'].replace('.png', '')) not in card_list:
card_list.append(name)
return None

View File

@ -3,14 +3,13 @@ from nonebot.adapters.onebot.v11 import Message, GroupMessageEvent, PrivateMessa
from nonebot.params import RegexDict, CommandArg
from nonebot.permission import SUPERUSER
from nonebot.plugin import PluginMetadata
from nonebot.rule import Rule
from nonebot.typing import T_State
from LittlePaimon import SUPERUSERS
from LittlePaimon.config import ConfigManager, PluginManager
from LittlePaimon.database import PluginDisable
from LittlePaimon.utils import logger
from LittlePaimon.utils.message import CommandObjectID
from LittlePaimon.utils.message import CommandObjectID, fullmatch_rule
from .draw_help import draw_help
__plugin_meta__ = PluginMetadata(
@ -24,10 +23,6 @@ __plugin_meta__ = PluginMetadata(
)
def fullmatch(msg: Message = CommandArg()) -> bool:
return not bool(msg)
manage_cmd = on_regex(
r'^pm (?P<func>ban|unban) (?P<plugin>([\w ]*)|all|全部) ?(-g (?P<group>[\d ]*) ?)?(-u (?P<user>[\d ]*) ?)?',
priority=1, block=True, state={
@ -36,7 +31,7 @@ manage_cmd = on_regex(
'pm_usage': 'pm ban|unban <插件名>',
'pm_priority': 1
})
help_cmd = on_command('help', aliases={'帮助', '菜单', 'pm help'}, priority=1, rule=Rule(fullmatch), block=True, state={
help_cmd = on_command('help', aliases={'帮助', '菜单', 'pm help'}, priority=1, rule=fullmatch_rule, block=True, state={
'pm_name': 'pm-help',
'pm_description': '查看本帮助',
'pm_usage': 'help',

View File

@ -8,6 +8,7 @@ from typing import Union, Optional, Tuple, List
from PIL import Image
from nonebot import get_bot
from nonebot.adapters.onebot.v11 import MessageEvent, Message, MessageSegment, GroupMessageEvent
from nonebot.rule import Rule
from nonebot.matcher import Matcher
from nonebot.params import CommandArg, Depends
from nonebot.typing import T_State
@ -95,6 +96,12 @@ class MessageBuild:
return MessageSegment.video(path)
def fullmatch(msg: Message = CommandArg()) -> bool:
return not bool(msg)
fullmatch_rule = Rule(fullmatch)
def CommandPlayer(limit: int = 3, only_cn: bool = True) -> List[Player]:
"""
获取查询操作中的user_iduid和图片并将过滤uid后的msg存放到T_State中