添加 override 标记

This commit is contained in:
2024-05-02 20:51:27 +08:00
parent bc37a015d6
commit 7a3d7c908c
4 changed files with 27 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ from nonebot_plugin_localstore import get_data_file # type: ignore[import-untyp
from nonebot_plugin_orm import get_session
from nonebot_plugin_userinfo import UserInfo as NBUserInfo # type: ignore[import-untyped]
from sqlalchemy import select
from typing_extensions import override
from zstandard import ZstdCompressor
from ...db import BindStatus, create_or_update_bind
@@ -63,15 +64,18 @@ class Processor(ProcessorMeta):
raw_response: RawResponse
processed_data: ProcessedData
@override
def __init__(self, event_id: int, user: User, command_args: list[str]) -> None:
super().__init__(event_id, user, command_args)
self.raw_response = RawResponse()
self.processed_data = ProcessedData()
@property
@override
def game_platform(self) -> Literal['IO']:
return GAME_TYPE
@override
async def handle_bind(self, platform: str, account: str, bot_info: NBUserInfo) -> UniMessage:
"""处理绑定消息"""
self.command_type = 'bind'
@@ -110,6 +114,7 @@ class Processor(ProcessorMeta):
)
return message
@override
async def handle_query(self) -> str:
"""处理查询消息"""
self.command_type = 'query'
@@ -149,6 +154,7 @@ class Processor(ProcessorMeta):
self.processed_data.user_records = user_records
return self.processed_data.user_records
@override
async def generate_message(self) -> str:
"""生成消息"""
user_info = await self.get_user_info()

View File

@@ -10,6 +10,7 @@ from nonebot_plugin_alconna.uniseg import UniMessage
from nonebot_plugin_orm import get_session
from nonebot_plugin_userinfo import UserInfo # type: ignore[import-untyped]
from pandas import read_html
from typing_extensions import override
from ...db import BindStatus, create_or_update_bind
from ...utils.avatar import get_avatar
@@ -30,6 +31,7 @@ class User(BaseUser):
name: str
@property
@override
def unique_identifier(self) -> str:
return self.name
@@ -57,15 +59,18 @@ class Processor(ProcessorMeta):
raw_response: RawResponse
processed_data: ProcessedData
@override
def __init__(self, event_id: int, user: User, command_args: list[str]) -> None:
super().__init__(event_id, user, command_args)
self.raw_response = RawResponse()
self.processed_data = ProcessedData()
@property
@override
def game_platform(self) -> Literal['TOP']:
return GAME_TYPE
@override
async def handle_bind(self, platform: str, account: str, bot_info: UserInfo, user_info: UserInfo) -> UniMessage:
"""处理绑定消息"""
self.command_type = 'bind'
@@ -99,6 +104,7 @@ class Processor(ProcessorMeta):
)
return message
@override
async def handle_query(self) -> str:
"""处理查询消息"""
self.command_type = 'query'
@@ -141,6 +147,7 @@ class Processor(ProcessorMeta):
total = Data(lpm=dataframe['lpm'].mean(), apm=dataframe['apm'].mean()) if len(dataframe) != 0 else None
return GameData(day=day, total=total)
@override
async def generate_message(self) -> str:
"""生成消息"""
game_data = await self.get_game_data()

View File

@@ -8,6 +8,7 @@ from nonebot.compat import type_validate_json
from nonebot_plugin_alconna.uniseg import UniMessage
from nonebot_plugin_orm import get_session
from nonebot_plugin_userinfo import UserInfo as NBUserInfo # type: ignore[import-untyped]
from typing_extensions import override
from ...db import BindStatus, create_or_update_bind
from ...utils.avatar import get_avatar
@@ -32,6 +33,7 @@ class User(BaseUser):
name: str | None = None
@property
@override
def unique_identifier(self) -> str:
if self.teaid is None:
raise ValueError('不完整的User!')
@@ -70,15 +72,18 @@ class Processor(ProcessorMeta):
raw_response: RawResponse
processed_data: ProcessedData
@override
def __init__(self, event_id: int, user: User, command_args: list[str]) -> None:
super().__init__(event_id, user, command_args)
self.raw_response = RawResponse(user_profile={})
self.processed_data = ProcessedData(user_profile={})
@property
@override
def game_platform(self) -> Literal['TOS']:
return GAME_TYPE
@override
async def handle_bind(self, platform: str, account: str, bot_info: NBUserInfo) -> UniMessage:
"""处理绑定消息"""
self.command_type = 'bind'
@@ -113,6 +118,7 @@ class Processor(ProcessorMeta):
)
return message
@override
async def handle_query(self) -> str:
"""处理查询消息"""
self.command_type = 'query'
@@ -229,6 +235,7 @@ class Processor(ProcessorMeta):
vs=round((adpm / 60 * 100), 2),
)
@override
async def generate_message(self) -> str:
"""生成消息"""
user_info = (await self.get_user_info()).data