diff --git a/bot/src/modules/base/events/base_on_voice_state_update_event.py b/bot/src/modules/base/events/base_on_voice_state_update_event.py index 7d8a2896..32036120 100644 --- a/bot/src/modules/base/events/base_on_voice_state_update_event.py +++ b/bot/src/modules/base/events/base_on_voice_state_update_event.py @@ -58,14 +58,22 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC): return try: + settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") + if joined: + active_joins = self._user_joins_vc.find_active_user_joined_voice_channels_by_user_id(user.id) + for join in active_joins: + join.leaved_on = datetime.now() + user.xp += round(join.time * settings.xp_per_ontime_hour) + self._user_joins_vc.update_user_joined_voice_channel(join) + self._users.update_user(user) + self._db.save_changes() + join = UserJoinedVoiceChannel(user, channel_id, datetime.now()) self._user_joins_vc.add_user_joined_voice_channel(join) self._db.save_changes() return - settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}") - join = self._user_joins_vc.get_active_user_joined_voice_channel_by_user_id(user.id) join.leaved_on = datetime.now() diff --git a/web/src/app/modules/view/server/profile/profile.component.html b/web/src/app/modules/view/server/profile/profile.component.html index 43cca8b0..7feb406d 100644 --- a/web/src/app/modules/view/server/profile/profile.component.html +++ b/web/src/app/modules/view/server/profile/profile.component.html @@ -31,7 +31,9 @@