Improved formatting #164

This commit is contained in:
Sven Heidemann 2023-01-12 07:33:53 +01:00
parent 5d6c55fc86
commit 849a92125a

View File

@ -181,8 +181,10 @@ class LevelGroup(DiscordCommandABC):
if levels.where(lambda l: l.name == level.name).first_or_default() is not None: if levels.where(lambda l: l.name == level.name).first_or_default() is not None:
self._logger.debug(__name__, f'Level with name {level.name} already exists') self._logger.debug(__name__, f'Level with name {level.name} already exists')
await self._message_service.send_ctx_msg(ctx, self._t.transform( await self._message_service.send_ctx_msg(
'modules.level.error.level_with_name_already_exists').format(level.name)) ctx,
self._t.transform('modules.level.error.level_with_name_already_exists').format(level.name)
)
elif levels.where(lambda l: l.min_xp == level.min_xp).first_or_default() is not None: elif levels.where(lambda l: l.min_xp == level.min_xp).first_or_default() is not None:
self._logger.debug(__name__, f'Level with min_xp {level.min_xp} already exists {level.name}') self._logger.debug(__name__, f'Level with min_xp {level.min_xp} already exists {level.name}')
found_level = levels.where(lambda l: l.min_xp == level.min_xp).first_or_default() found_level = levels.where(lambda l: l.min_xp == level.min_xp).first_or_default()
@ -370,8 +372,9 @@ class LevelGroup(DiscordCommandABC):
levels = self._levels.get_levels_by_server_id(server.server_id).order_by(lambda l: l.min_xp) levels = self._levels.get_levels_by_server_id(server.server_id).order_by(lambda l: l.min_xp)
if level == levels.first(): if level == levels.first():
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.down.already_first').format( await self._message_service.send_ctx_msg(
member.mention)) ctx, self._t.transform('modules.level.down.already_first').format(member.mention)
)
self._logger.trace(__name__, f'Finished command level down') self._logger.trace(__name__, f'Finished command level down')
return return
@ -406,8 +409,10 @@ class LevelGroup(DiscordCommandABC):
levels = self._levels.get_levels_by_server_id(server.server_id).order_by(lambda l: l.min_xp) levels = self._levels.get_levels_by_server_id(server.server_id).order_by(lambda l: l.min_xp)
if level.name == levels.last().name: if level.name == levels.last().name:
await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.up.already_last').format( await self._message_service.send_ctx_msg(
member.mention)) ctx,
self._t.transform('modules.level.up.already_last').format(member.mention)
)
self._logger.trace(__name__, f'Finished command level up') self._logger.trace(__name__, f'Finished command level up')
return return