mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ac4631d1f3 | |||
| b0ee7fe6c7 | |||
| 5bcecc0623 | |||
| 9cf048fce4 |
@@ -312,7 +312,10 @@ class Processor(ProcessorMeta):
|
|||||||
user=TETRIOInfo.User(
|
user=TETRIOInfo.User(
|
||||||
avatar=f'https://tetr.io/user-content/avatars/{user_info.data.user.id}.jpg?rv={user_info.data.user.avatar_revision}'
|
avatar=f'https://tetr.io/user-content/avatars/{user_info.data.user.id}.jpg?rv={user_info.data.user.avatar_revision}'
|
||||||
if user_info.data.user.avatar_revision is not None
|
if user_info.data.user.avatar_revision is not None
|
||||||
else f'{{"type":"identicon","hash":"{md5(user_info.data.user.id.encode()).hexdigest()}"}}', # noqa: S324
|
else TETRIOInfo.User.Avatar(
|
||||||
|
type='identicon',
|
||||||
|
hash=md5(user_info.data.user.id.encode()).hexdigest(), # noqa: S324
|
||||||
|
),
|
||||||
name=user_name,
|
name=user_name,
|
||||||
bio=user_info.data.user.bio,
|
bio=user_info.data.user.bio,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ class Bind(BaseModel):
|
|||||||
|
|
||||||
class TETRIOInfo(BaseModel):
|
class TETRIOInfo(BaseModel):
|
||||||
class User(BaseModel):
|
class User(BaseModel):
|
||||||
avatar: str
|
class Avatar(BaseModel):
|
||||||
|
type: Literal['identicon']
|
||||||
|
hash: str
|
||||||
|
|
||||||
|
avatar: str | Avatar
|
||||||
name: str
|
name: str
|
||||||
bio: str | None
|
bio: str | None
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,16 @@ from shutil import rmtree
|
|||||||
|
|
||||||
from nonebot import get_driver
|
from nonebot import get_driver
|
||||||
from nonebot.log import logger
|
from nonebot.log import logger
|
||||||
|
from nonebot.permission import SUPERUSER
|
||||||
|
from nonebot_plugin_alconna import on_alconna
|
||||||
from nonebot_plugin_localstore import get_data_dir # type: ignore[import-untyped]
|
from nonebot_plugin_localstore import get_data_dir # type: ignore[import-untyped]
|
||||||
|
|
||||||
driver = get_driver()
|
driver = get_driver()
|
||||||
|
|
||||||
templates_dir = get_data_dir('nonebot_plugin_tetris_stats') / 'templates'
|
templates_dir = get_data_dir('nonebot_plugin_tetris_stats') / 'templates'
|
||||||
|
|
||||||
|
alc = on_alconna('更新模板', permission=SUPERUSER)
|
||||||
|
|
||||||
|
|
||||||
@driver.on_startup
|
@driver.on_startup
|
||||||
async def init_templates() -> None:
|
async def init_templates() -> None:
|
||||||
@@ -58,3 +62,9 @@ async def init_templates() -> None:
|
|||||||
logger.error(i)
|
logger.error(i)
|
||||||
raise RuntimeError('更新模板仓库失败')
|
raise RuntimeError('更新模板仓库失败')
|
||||||
logger.success('模板仓库更新成功')
|
logger.success('模板仓库更新成功')
|
||||||
|
|
||||||
|
|
||||||
|
@alc.handle()
|
||||||
|
async def _():
|
||||||
|
await init_templates()
|
||||||
|
await alc.finish('模板仓库更新成功')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = 'nonebot-plugin-tetris-stats'
|
name = 'nonebot-plugin-tetris-stats'
|
||||||
version = '1.1.2'
|
version = '1.1.4'
|
||||||
description = '一款基于 NoneBot2 的用于查询 Tetris 相关游戏数据的插件'
|
description = '一款基于 NoneBot2 的用于查询 Tetris 相关游戏数据的插件'
|
||||||
authors = ['scdhh <wallfjjd@gmail.com>']
|
authors = ['scdhh <wallfjjd@gmail.com>']
|
||||||
readme = 'README.md'
|
readme = 'README.md'
|
||||||
|
|||||||
Reference in New Issue
Block a user