Improved profile voice states & fixed new vs handling
All checks were successful
Deploy staging on push / on-push-deploy_sh-edraft (push) Successful in 5m31s

This commit is contained in:
2023-11-20 09:28:53 +01:00
parent 0c807a7de7
commit 5f8ae787f0
3 changed files with 36 additions and 14 deletions

View File

@@ -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()