0.3 #146

Merged
edraft merged 359 commits from 0.3 into master 2023-01-12 07:04:40 +01:00
3 changed files with 9 additions and 1 deletions
Showing only changes of commit 356dc1848c - Show all commits

View File

@ -162,6 +162,7 @@
"discord_join": "Discord beigetreten am",
"last_join": "Server beigetreten am",
"xp": "XP",
"ontime": "Ontime",
"roles": "Rollen",
"joins": "Beitritte",
"lefts": "Abgänge",

View File

@ -16,7 +16,7 @@ class UserJoinedVoiceChannelRepositoryABC(ABC):
def get_user_joined_voice_channel_by_id(self, id: int) -> UserJoinedVoiceChannel: pass
@abstractmethod
def get_user_joined_voice_channels_by_user_id(self, user_id: int) -> list[UserJoinedVoiceChannel]: pass
def get_user_joined_voice_channels_by_user_id(self, user_id: int) -> List[UserJoinedVoiceChannel]: pass
@abstractmethod
def get_active_user_joined_voice_channel_by_user_id(self, user_id: int) -> UserJoinedVoiceChannel: pass

View File

@ -14,6 +14,7 @@ from bot_core.logging.command_logger import CommandLogger
from bot_core.pipes.date_time_offset_pipe import DateTimeOffsetPipe
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
from modules.permission.abc.permission_service_abc import PermissionServiceABC
@ -31,6 +32,7 @@ class UserGroup(DiscordCommandABC):
servers: ServerRepositoryABC,
users: UserRepositoryABC,
user_joined_servers: UserJoinedServerRepositoryABC,
user_joined_voice_channel: UserJoinedVoiceChannelRepositoryABC,
translate: TranslatePipe,
date: DateTimeOffsetPipe
):
@ -45,6 +47,7 @@ class UserGroup(DiscordCommandABC):
self._servers = servers
self._users = users
self._user_joined_servers = user_joined_servers
self._user_joined_voice_channel = user_joined_voice_channel
self._t = translate
self._date = date
@ -81,11 +84,15 @@ class UserGroup(DiscordCommandABC):
color=int('ef9d0d', 16)
)
ujvs = self._user_joined_voice_channel.get_user_joined_voice_channels_by_user_id(user.user_id)
ontime = ujvs.sum(lambda join: round((join.leaved_on - join.joined_on).total_seconds() / 3600, 2))
embed.add_field(name=self._t.transform('modules.base.user_info.fields.id'), value=member.id)
embed.add_field(name=self._t.transform('modules.base.user_info.fields.name'), value=member.name)
embed.add_field(name=self._t.transform('modules.base.user_info.fields.discord_join'), value=self._date.transform(member.created_at), inline=False)
embed.add_field(name=self._t.transform('modules.base.user_info.fields.last_join'), value=self._date.transform(member.joined_at), inline=False)
embed.add_field(name=self._t.transform('modules.base.user_info.fields.xp'), value=str(user.xp))
embed.add_field(name=self._t.transform('modules.base.user_info.fields.ontime'), value=str(ontime))
roles = ''
for role in member.roles: