Improved formatting #166
This commit is contained in:
parent
b80958e3ab
commit
3cf0fe3479
@ -84,8 +84,11 @@ class ClientUtilsService(ClientUtilsServiceABC):
|
||||
async def check_if_bot_is_ready_yet_and_respond(self, ctx: Context) -> bool:
|
||||
result = await self.check_if_bot_is_ready_yet()
|
||||
if not result:
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('common.errors.bot_not_ready_yet'),
|
||||
without_tracking=True)
|
||||
await self._message_service.send_ctx_msg(
|
||||
ctx,
|
||||
self._t.transform('common.errors.bot_not_ready_yet'),
|
||||
without_tracking=True
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
|
@ -166,8 +166,10 @@ class UserGroup(DiscordCommandABC):
|
||||
))
|
||||
|
||||
else:
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform(
|
||||
'modules.base.user.error.atr_not_found').format(atr))
|
||||
await self._message_service.send_interaction_msg(
|
||||
ctx.interaction,
|
||||
self._t.transform('modules.base.user.error.atr_not_found').format(atr)
|
||||
)
|
||||
return
|
||||
|
||||
await self._message_service.send_interaction_msg(
|
||||
@ -194,16 +196,19 @@ class UserGroup(DiscordCommandABC):
|
||||
|
||||
if atr == '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'))
|
||||
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)
|
||||
except TypeError as te:
|
||||
self._logger.error(__name__, f'String value couldn\'t be converted to int', te)
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform(
|
||||
'modules.base.user.set.error.type_error'))
|
||||
await self._message_service.send_interaction_msg(
|
||||
ctx.interaction,
|
||||
self._t.transform('modules.base.user.set.error.type_error')
|
||||
)
|
||||
return
|
||||
else:
|
||||
self._users.update_user(user)
|
||||
@ -211,12 +216,16 @@ class UserGroup(DiscordCommandABC):
|
||||
await self._level.check_level(member)
|
||||
|
||||
else:
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform(
|
||||
'modules.base.user.error.atr_not_found').format(atr))
|
||||
await self._message_service.send_interaction_msg(
|
||||
ctx.interaction,
|
||||
self._t.transform('modules.base.user.error.atr_not_found').format(atr)
|
||||
)
|
||||
return
|
||||
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform(
|
||||
f'modules.base.user.set.{atr.lower()}').format(member.mention, value))
|
||||
await self._message_service.send_interaction_msg(
|
||||
ctx.interaction,
|
||||
self._t.transform(f'modules.base.user.set.{atr.lower()}').format(member.mention, value)
|
||||
)
|
||||
|
||||
@set.autocomplete('atr')
|
||||
async def set_autocomplete(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]:
|
||||
@ -247,8 +256,10 @@ class UserGroup(DiscordCommandABC):
|
||||
self._db.save_changes()
|
||||
|
||||
else:
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, self._t.transform(
|
||||
'modules.base.user.error.atr_not_found').format(atr))
|
||||
await self._message_service.send_interaction_msg(
|
||||
ctx.interaction,
|
||||
self._t.transform('modules.base.user.error.atr_not_found').format(atr)
|
||||
)
|
||||
return
|
||||
|
||||
await self._message_service.send_interaction_msg(
|
||||
@ -258,5 +269,6 @@ class UserGroup(DiscordCommandABC):
|
||||
|
||||
@remove.autocomplete('atr')
|
||||
async def remove_autocomplete(self, interaction: discord.Interaction, current: str) -> List[
|
||||
app_commands.Choice[str]]:
|
||||
app_commands.Choice[str]
|
||||
]:
|
||||
return [app_commands.Choice(name=value, value=key) for key, value in self._atr_list]
|
||||
|
@ -83,13 +83,18 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
|
||||
self._users.update_user(user)
|
||||
self._db.save_changes()
|
||||
|
||||
self._logger.debug(__name__, f'User {user} leaved_on {join.leaved_on}. Ontime: {ontime}h | xp: from {old_xp} to {user.xp}')
|
||||
self._logger.debug(__name__,
|
||||
f'User {user} leaved_on {join.leaved_on}. Ontime: {ontime}h | xp: from {old_xp} to {user.xp}')
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f'Ontime validation failed', e)
|
||||
|
||||
@EventChecks.check_is_ready()
|
||||
async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState,
|
||||
after: discord.VoiceState):
|
||||
async def on_voice_state_update(
|
||||
self,
|
||||
member: discord.Member,
|
||||
before: discord.VoiceState,
|
||||
after: discord.VoiceState
|
||||
):
|
||||
self._logger.debug(__name__, f'Module {type(self)} started')
|
||||
self._logger.trace(__name__, f'Detected on_voice_state_update {member.id} from {before} to {after}')
|
||||
settings: BaseServerSettings = self._base_helper.get_config(member.guild.id)
|
||||
|
Loading…
Reference in New Issue
Block a user