Improved imports #130

This commit is contained in:
Sven Heidemann 2023-02-18 14:45:51 +01:00
parent 610ce42fa2
commit da3680a83e
2 changed files with 9 additions and 5 deletions

View File

@ -5,6 +5,7 @@ from typing import Callable
from cpl_query.extension import List from cpl_query.extension import List
from discord.ext.commands import Context from discord.ext.commands import Context
from bot_data.model.user import User
from modules.base.configuration.base_server_settings import BaseServerSettings from modules.base.configuration.base_server_settings import BaseServerSettings
@ -49,12 +50,12 @@ class ClientUtilsABC(ABC):
def is_message_xp_count_by_hour_higher_that_max_message_count_per_hour( def is_message_xp_count_by_hour_higher_that_max_message_count_per_hour(
self, self,
created_at: datetime, created_at: datetime,
user: "User", user: User,
settings: BaseServerSettings, settings: BaseServerSettings,
is_reaction: bool = False, is_reaction: bool = False,
) -> bool: ) -> bool:
pass pass
@abstractmethod @abstractmethod
def get_ontime_for_user(self, user: "User") -> float: def get_ontime_for_user(self, user: User) -> float:
pass pass

View File

@ -5,7 +5,7 @@ from cpl_core.database import TableABC
from cpl_core.dependency_injection import ServiceProviderABC from cpl_core.dependency_injection import ServiceProviderABC
from cpl_discord.service import DiscordBotServiceABC from cpl_discord.service import DiscordBotServiceABC
from bot_core.abc.client_utils_abc import ClientUtilsABC from bot_data.model.level import Level
from bot_data.model.server import Server from bot_data.model.server import Server
@ -63,12 +63,15 @@ class User(TableABC):
@property @property
@ServiceProviderABC.inject @ServiceProviderABC.inject
def ontime(self, client_utils: ClientUtilsABC) -> float: def ontime(self, services: ServiceProviderABC) -> float:
from bot_core.abc.client_utils_abc import ClientUtilsABC
client_utils: ClientUtilsABC = services.get_service(ClientUtilsABC)
return client_utils.get_ontime_for_user(self) return client_utils.get_ontime_for_user(self)
@property @property
@ServiceProviderABC.inject @ServiceProviderABC.inject
def level(self, services: ServiceProviderABC) -> "Level": def level(self, services: ServiceProviderABC) -> Level:
from modules.level.service.level_service import LevelService from modules.level.service.level_service import LevelService
levels: LevelService = services.get_service(LevelService) levels: LevelService = services.get_service(LevelService)