Fixed not checking level after new XP is assinged to user #22
This commit is contained in:
parent
cf610b770b
commit
5a4c2901f5
@ -181,11 +181,14 @@
|
||||
"ontime": "{} war insgesamt {} Stunden aktiv in einem Sprachkanal"
|
||||
},
|
||||
"set": {
|
||||
"xp": "{} hat nun {} xp"
|
||||
"xp": "{} hat nun {} xp",
|
||||
"error": {
|
||||
"value_type_not_numeric": "Der angegebende Wert ist keine Ganzzahl! :(",
|
||||
"set_xp": "Es kam zu einem Fehler bei der Zuweisung der XP :("
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"atr_not_found": "Das Attribut {} konnte nicht gefunden werden :(",
|
||||
"value_type": "Der angegebende Wert konnte nicht für das Attribut interpretiert werden :("
|
||||
"atr_not_found": "Das Attribut {} konnte nicht gefunden werden :("
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -19,6 +19,7 @@ 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.level.service.level_service import LevelService
|
||||
from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
|
||||
|
||||
@ -38,7 +39,8 @@ class UserGroup(DiscordCommandABC):
|
||||
user_joined_servers: UserJoinedServerRepositoryABC,
|
||||
user_joined_voice_channel: UserJoinedVoiceChannelRepositoryABC,
|
||||
translate: TranslatePipe,
|
||||
date: DateTimeOffsetPipe
|
||||
date: DateTimeOffsetPipe,
|
||||
level: LevelService
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
||||
@ -55,6 +57,7 @@ class UserGroup(DiscordCommandABC):
|
||||
self._user_joined_voice_channel = user_joined_voice_channel
|
||||
self._t = translate
|
||||
self._date = date
|
||||
self._level = level
|
||||
|
||||
self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
|
||||
|
||||
@ -186,13 +189,18 @@ class UserGroup(DiscordCommandABC):
|
||||
|
||||
match atr:
|
||||
case 'xp':
|
||||
if not value.isnumeric():
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.set.error.value_type_not_numeric'))
|
||||
return
|
||||
|
||||
try:
|
||||
user.xp = int(value)
|
||||
self._users.update_user(user)
|
||||
self._db.save_changes()
|
||||
await self._level.check_level(member)
|
||||
except Exception as e:
|
||||
await self._logger.trace(__name__, f'Value couldn\'t be converted to int\n'+e)
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.error.value_type'))
|
||||
self._logger.error(__name__, f'Value couldn\'t be converted to int', e)
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform('modules.base.user.set.error.set_xp'))
|
||||
return
|
||||
|
||||
case other:
|
||||
|
Loading…
Reference in New Issue
Block a user