Skip to content

Commit

Permalink
增加插件 metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
djkcyl committed Jun 27, 2023
1 parent bf8c764 commit bbea005
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 147 deletions.
15 changes: 15 additions & 0 deletions haruka_bot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from nonebot.plugin import PluginMetadata
from nonebot.plugin.manager import PluginLoader

if isinstance(globals()["__loader__"], PluginLoader):
Expand All @@ -8,3 +9,17 @@
from . import plugins # noqa: F401

from .version import VERSION, __version__ # noqa: F401

__plugin_meta__ = PluginMetadata(
name="haruka_bot",
description="将B站UP主的动态和直播信息推送至QQ",
usage="https://haruka-bot.sk415.icu/",
homepage="https://github.com/SK-415/HarukaBot",
type="application",
supported_adapters={"~onebot.v11", "~qqguild"},
extra={
"author": "SK-415",
"version": __version__,
"priority": 1,
},
)
1 change: 1 addition & 0 deletions haruka_bot/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def create_env():
if any(Path.cwd().iterdir()):
print("文件夹不为空,请更换空文件夹后重试")
import sys

sys.exit()

while True:
Expand Down
2 changes: 2 additions & 0 deletions haruka_bot/libs/dynamic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from typing import Optional
from nonebot.adapters.onebot.v11.message import MessageSegment, Message
from pydantic import BaseModel, root_validator

# from pydantic import Json

from .desc import Desc

# from .card import Card
# from .display import Display

Expand Down
2 changes: 1 addition & 1 deletion haruka_bot/libs/dynamic/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ class Card(BaseModel):

apiSeasonInfo: Optional[APISeasonInfo]

new_desc: Optional[str]
new_desc: Optional[str]
2 changes: 1 addition & 1 deletion haruka_bot/libs/dynamic/desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class Desc(BaseModel):
# dynamic_id_str: str
# pre_dy_id_str: str
# orig_dy_id_str: str
# rid_str: str
# rid_str: str
1 change: 1 addition & 0 deletions haruka_bot/libs/dynamic/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class EmojiDetail(BaseModel):

class EmojiInfo(BaseModel):
"""emoji 信息"""

emoji_details: List[EmojiDetail]


Expand Down
7 changes: 6 additions & 1 deletion haruka_bot/libs/dynamic/user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class Info(BaseModel):
"""用户信息"""

uid: Optional[int]
uname: Optional[str]
face: Optional[str]
Expand All @@ -14,18 +15,21 @@ class Info(BaseModel):

class LevelInfo(BaseModel):
"""等级信息"""

current_level: Optional[int]


class Pendant(BaseModel):
"""挂件"""

pid: int
name: str
image: str


class OfficialVerify(BaseModel):
"""账号认证信息"""

type: int
desc: str

Expand All @@ -36,6 +40,7 @@ class Card(BaseModel):

class VIP(BaseModel):
"""大会员信息"""

vipType: int
nickname_color: str

Expand All @@ -45,4 +50,4 @@ class UserProfile(BaseModel):
level_info: Optional[LevelInfo]
pendant: Optional[Pendant]
card: Optional[Card]
vip: Optional[VIP]
vip: Optional[VIP]
2 changes: 1 addition & 1 deletion haruka_bot/utils/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def get_dynamic_screenshot_mobile(dynamic_id):
try:
await page.route(re.compile("^https://static.graiax/fonts/(.+)$"), fill_font)
if plugin_config.haruka_captcha_address:
page = await resolve_captcha(url,page)
page = await resolve_captcha(url, page)
else:
await page.goto(
url,
Expand Down
2 changes: 1 addition & 1 deletion haruka_bot/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from packaging.version import Version

__version__ = "1.6.0"
__version__ = "1.6.0post1"
VERSION = Version(__version__)
267 changes: 134 additions & 133 deletions pdm.lock

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ license = {text = "AGPL-3.0-or-later"}
requires-python = ">=3.8,<4.0"
dependencies = [
"click>=8.1.3",
"httpx>=0.24.0",
"httpx>=0.24.1",
"nonebot-adapter-onebot>=2.2.3",
"nonebot-plugin-apscheduler>=0.2.0",
"nonebot2[fastapi]>=2.0.0rc4",
"playwright>=1.33.0",
"pydantic>=1.10.7",
"nonebot-plugin-apscheduler>=0.3.0",
"nonebot2[fastapi]>=2.0.0",
"playwright>=1.35.0",
"pydantic>=1.10.9",
"python-dotenv>=1.0.0",
"tortoise-orm[asyncpg]>=0.19.3",
"bilireq>=0.2.5",
"bilireq>=0.2.6",
"packaging>=23.1",
"nonebot-plugin-guild-patch>=0.2.3",
"msvc-runtime>=14.34.31931; sys_platform == \"win32\"",
Expand Down Expand Up @@ -52,9 +52,6 @@ hb = "haruka_bot.__main__:main"
source = "file"
path = "haruka_bot/version.py"

[tool.pdm.build]
# includes = ["haruka_bot/web/build/**/*"]

[build-system]
requires = ["pdm-pep517>=1.0.0"]
build-backend = "pdm.pep517.api"

0 comments on commit bbea005

Please sign in to comment.