mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-acgnshow.git
synced 2024-11-11 01:27:39 +08:00
✨添加插件用法,更改配置项名称
This commit is contained in:
parent
05c6119369
commit
72f040c7af
@ -4,14 +4,28 @@ require("nonebot_plugin_alconna")
|
||||
from .acgnshower import *
|
||||
from nonebot import get_driver
|
||||
from .config import ConfigModel
|
||||
usage = """命令格式:
|
||||
展览 <地区> [页码]
|
||||
或
|
||||
<地区>展览 [页码]
|
||||
其中地区为省级行政区或地级行政区(不包含后缀)
|
||||
(如北京,福建,平顶山,绍兴,香港...,或海外/全国)
|
||||
|
||||
示例:
|
||||
展览 福建 2
|
||||
福建展览 2
|
||||
全国展览
|
||||
海外展览"""
|
||||
__author__ = "Asankilp"
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="漫展/展览查询",
|
||||
description="从哔哩哔哩会员购获取简易展览数据",
|
||||
usage="application",
|
||||
usage=usage,
|
||||
type="application",
|
||||
config=ConfigModel,
|
||||
homepage="https://github.com/LiteyukiStudio/nonebot-plugin-acgnshow",
|
||||
supported_adapters=inherit_supported_adapters("nonebot_plugin_alconna")
|
||||
supported_adapters=inherit_supported_adapters("nonebot_plugin_alconna"),
|
||||
extra={"License":"MIT","Author":"Asankilp"}
|
||||
)
|
||||
driver = get_driver()
|
||||
|
||||
|
@ -9,7 +9,7 @@ from nonebot_plugin_alconna import on_alconna
|
||||
from arclet.alconna import Alconna, Args
|
||||
from .config import RES_PATH, TEMPLATE_NAME, config
|
||||
from .util import *
|
||||
|
||||
from .__init__ import __plugin_meta__
|
||||
showcmd = on_alconna(
|
||||
Alconna(
|
||||
"展览",
|
||||
@ -29,14 +29,14 @@ showcmd.shortcut(
|
||||
async def find_show(
|
||||
state: T_State, region: Optional[str] = None, page: Optional[int] = None, date: Optional[str] = None,
|
||||
):
|
||||
if not region: await showcmd.finish("未指定地区")
|
||||
if not region: await showcmd.finish(__plugin_meta__.usage)
|
||||
if not page: page = 1
|
||||
if not date: date = ""
|
||||
regions_dict = get_regions_dict()
|
||||
regionid = regions_dict.get(region,None)
|
||||
if regionid == None: await showcmd.finish("未找到此地区") ; return
|
||||
#await showcmd.send("日期:"+ date)
|
||||
shows = get_shows_data(regionid,page=page,pagesize=config.pagesize)
|
||||
shows = get_shows_data(regionid,page=page,pagesize=config.acgnshow_pagesize)
|
||||
# print(shows)
|
||||
template = {
|
||||
"shows":process_shows_data_to_template(shows),
|
||||
|
@ -6,6 +6,6 @@ TEMPLATE_NAME = "template.html"
|
||||
BGIMAGE_PATH = RES_PATH / "bgimage"
|
||||
|
||||
class ConfigModel(BaseModel):
|
||||
pagesize: int = 8
|
||||
acgnshow_pagesize: int = 8
|
||||
|
||||
config: ConfigModel = get_plugin_config(ConfigModel)
|
Loading…
Reference in New Issue
Block a user