Mitglieder auf einem Server anzeigen #130 #206

Merged
edraft merged 18 commits from #130 into 1.0.0 2023-02-18 14:56:39 +01:00
2 changed files with 9 additions and 5 deletions
Showing only changes of commit da3680a83e - Show all commits

View File

@ -5,6 +5,7 @@ from typing import Callable
from cpl_query.extension import List
from discord.ext.commands import Context
from bot_data.model.user import User
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(
self,
created_at: datetime,
user: "User",
user: User,
settings: BaseServerSettings,
is_reaction: bool = False,
) -> bool:
pass
@abstractmethod
def get_ontime_for_user(self, user: "User") -> float:
def get_ontime_for_user(self, user: User) -> float:
pass

View File

@ -5,7 +5,7 @@ from cpl_core.database import TableABC
from cpl_core.dependency_injection import ServiceProviderABC
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
@ -63,12 +63,15 @@ class User(TableABC):
@property
@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)
@property
@ServiceProviderABC.inject
def level(self, services: ServiceProviderABC) -> "Level":
def level(self, services: ServiceProviderABC) -> Level:
from modules.level.service.level_service import LevelService
levels: LevelService = services.get_service(LevelService)