Reviewed-on: sh-edraft.de/kd_discord_bot#122 Reviewed-by: Ebola-Chan <nick.jungmann@gmail.com> Closes #119
This commit is contained in:
commit
549b05087f
@ -62,10 +62,14 @@ class UserGroup(DiscordCommandABC):
|
||||
@user.command()
|
||||
@commands.guild_only()
|
||||
@CommandChecks.check_is_ready()
|
||||
@CommandChecks.check_is_member_moderator()
|
||||
async def info(self, ctx: Context, member: Optional[discord.Member] = None, *, wait: int = None):
|
||||
self._logger.debug(__name__, f'Received command user-info {ctx}:{member},{wait}')
|
||||
|
||||
is_mod = self._permissions.is_member_moderator(ctx.author)
|
||||
if member is not None and not is_mod:
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('common.no_permission_message'))
|
||||
return
|
||||
|
||||
if member is None or not isinstance(member, discord.Member):
|
||||
member = ctx.author
|
||||
|
||||
@ -94,20 +98,26 @@ class UserGroup(DiscordCommandABC):
|
||||
roles += f'{role.name}\n'
|
||||
embed.add_field(name=self._t.transform('modules.base.user_info.fields.roles'), value=roles, inline=False)
|
||||
|
||||
joins_string = ''
|
||||
for join in joins:
|
||||
joins_string += f'{self._date.transform(join.joined_on)}\n'
|
||||
embed.add_field(name=self._t.transform('modules.base.user_info.fields.joins'), value=joins_string)
|
||||
if is_mod or member == ctx.author:
|
||||
joins_string = ''
|
||||
for join in joins:
|
||||
joins_string += f'{self._date.transform(join.joined_on)}\n'
|
||||
embed.add_field(name=self._t.transform('modules.base.user_info.fields.joins'), value=joins_string)
|
||||
|
||||
lefts_string = ''
|
||||
for join in joins:
|
||||
if join.leaved_on is None:
|
||||
if lefts_string == '':
|
||||
lefts_string = '/'
|
||||
continue
|
||||
lefts_string += f'{self._date.transform(join.leaved_on)}\n'
|
||||
embed.add_field(name=self._t.transform('modules.base.user_info.fields.lefts'), value=lefts_string)
|
||||
embed.add_field(name=self._t.transform('modules.base.user_info.fields.warnings'), value=self._t.transform('common.not_implemented_yet'), inline=False)
|
||||
if is_mod or member == ctx.author:
|
||||
lefts_string = ''
|
||||
for join in joins:
|
||||
if join.leaved_on is None:
|
||||
if lefts_string == '':
|
||||
lefts_string = '/'
|
||||
continue
|
||||
lefts_string += f'{self._date.transform(join.leaved_on)}\n'
|
||||
|
||||
await self._message_service.send_ctx_msg(ctx, embed, wait_before_delete=wait)
|
||||
embed.add_field(name=self._t.transform('modules.base.user_info.fields.lefts'), value=lefts_string)
|
||||
|
||||
if is_mod or member == ctx.author:
|
||||
embed.add_field(name=self._t.transform('modules.base.user_info.fields.warnings'), value=self._t.transform('common.not_implemented_yet'), inline=False)
|
||||
|
||||
# send to interaction because of sensitive data
|
||||
await self._message_service.send_interaction_msg(ctx.interaction, embed, wait_before_delete=wait)
|
||||
self._logger.trace(__name__, f'Finished user-info command')
|
||||
|
@ -128,8 +128,7 @@ class PermissionService(PermissionServiceABC):
|
||||
return member.guild.id in self._admins and member in self._admins[member.guild.id]
|
||||
|
||||
def is_member_moderator(self, member: discord.Member) -> bool:
|
||||
return member.guild.id in self._moderators \
|
||||
and member in self._moderators[member.guild.id] or self.is_member_admin(member)
|
||||
return member.guild.id in self._moderators and member in self._moderators[member.guild.id] or self.is_member_admin(member)
|
||||
|
||||
def is_member_technician(self, member: discord.Member) -> bool:
|
||||
return member in self._technicians
|
||||
|
Loading…
Reference in New Issue
Block a user