@commands.bot_has_permissions(manage_roles=True, send_messages=True)
@commands.before_invoke(record_usage)
@cog_ext.cog_slash(name='mute', description='Mutes a member in the server', guild_ids=[settings.get_value('guild_id')], options=[create_option(name='member', description='The member that will be muted', option_type=6, required=True), create_option(name='reason', description='The reason why the member is being muted', option_type=3, required=False), create_option(name='duration', description='The length of time the user will be muted for', option_type=3, required=False)], default_permission=False, permissions={settings.get_value('guild_id'): [create_permission(settings.get_value('role_staff'), SlashCommandPermissionType.ROLE, True), create_permission(settings.get_value('role_trial_mod'), SlashCommandPermissionType.ROLE, True)]})
async def mute(self, ctx: SlashContext, member: discord.Member, duration: str=None, reason: str=None):
    ' Mutes member in guild. '
    (await ctx.defer())
    if (not isinstance(member, discord.Member)):
        (await embeds.error_message(ctx=ctx, description=f'That user is not in the server.'))
        return
    if (not (await can_action_member(bot=self.bot, ctx=ctx, member=member))):
        (await embeds.error_message(ctx=ctx, description=f'You cannot action {member.mention}.'))
        return
    if (await self.is_user_muted(ctx=ctx, member=member)):
        (await embeds.error_message(ctx=ctx, description=f'{member.mention} is already muted.'))
        return
    if (not reason):
        reason = 'No reason provided.'
    elif (len(reason) > 512):
        (await embeds.error_message(ctx=ctx, description='Reason must be less than 512 characters.'))
        return
    if (not duration):
        embed = embeds.make_embed(ctx=ctx, title=f'Muting member: {member.name}', description=f'{member.mention} was muted by {ctx.author.mention} for: {reason}', thumbnail_url='https://i.imgur.com/rHtYWIt.png', color='soft_red')
        channel = (await self.create_mute_channel(ctx=ctx, member=member, reason=reason))
        if (not (await self.send_muted_dm_embed(ctx=ctx, member=member, channel=channel, reason=reason))):
            embed.add_field(name='Notice:', value=f'Unable to message {member.mention} about this action. This can be caused by the user not being in the server, having DMs disabled, or having the bot blocked.')
        (await self.mute_member(ctx=ctx, member=member, reason=reason))
        (await ctx.send(embed=embed))
        return
    (duration_string, mute_end_time) = utils.duration.get_duration(duration=duration)
    if (not duration_string):
        (await embeds.error_message(ctx=ctx, description=f'''Duration syntax: `#d#h#m#s` (day, hour, min, sec)
You can specify up to all four but you only need one.'''))
        return
    embed = embeds.make_embed(ctx=ctx, title=f'Muting member: {member}', thumbnail_url='https://i.imgur.com/rHtYWIt.png', color='soft_red')
    embed.description = f'{member.mention} was muted by {ctx.author.mention} for: {reason}'
    embed.add_field(name='Duration:', value=duration_string, inline=False)
    channel = (await self.create_mute_channel(ctx=ctx, member=member, reason=reason, duration=duration_string))
    if (not (await self.send_muted_dm_embed(ctx=ctx, member=member, channel=channel, reason=reason, duration=duration_string))):
        embed.add_field(name='Notice:', value=f'Unable to message {member.mention} about this action. This can be caused by the user not being in the server, having DMs disabled, or having the bot blocked.')
    (await self.mute_member(ctx=ctx, member=member, reason=reason, temporary=True, end_time=mute_end_time.timestamp()))
    (await ctx.send(embed=embed))
Mutes member in guild.
@commands.bot_has_permissions(manage_roles=True, send_messages=True)
@commands.before_invoke(record_usage)
@cog_ext.cog_slash(name='mute', description='Mutes a member in the server', guild_ids=[settings.get_value('guild_id')], options=[create_option(name='member', description='The member that will be muted', option_type=6, required=True), create_option(name='reason', description='The reason why the member is being muted', option_type=3, required=False), create_option(name='duration', description='The length of time the user will be muted for', option_type=3, required=False)], default_permission=False, permissions={settings.get_value('guild_id'): [create_permission(settings.get_value('role_staff'), SlashCommandPermissionType.ROLE, True), create_permission(settings.get_value('role_trial_mod'), SlashCommandPermissionType.ROLE, True)]})
async def mute(self, ctx: SlashContext, member: discord.Member, duration: str=None, reason: str=None):
    '  '
    (await ctx.defer())
    if (not isinstance(member, discord.Member)):
        (await embeds.error_message(ctx=ctx, description=f'That user is not in the server.'))
        return
    if (not (await can_action_member(bot=self.bot, ctx=ctx, member=member))):
        (await embeds.error_message(ctx=ctx, description=f'You cannot action {member.mention}.'))
        return
    if (await self.is_user_muted(ctx=ctx, member=member)):
        (await embeds.error_message(ctx=ctx, description=f'{member.mention} is already muted.'))
        return
    if (not reason):
        reason = 'No reason provided.'
    elif (len(reason) > 512):
        (await embeds.error_message(ctx=ctx, description='Reason must be less than 512 characters.'))
        return
    if (not duration):
        embed = embeds.make_embed(ctx=ctx, title=f'Muting member: {member.name}', description=f'{member.mention} was muted by {ctx.author.mention} for: {reason}', thumbnail_url='https://i.imgur.com/rHtYWIt.png', color='soft_red')
        channel = (await self.create_mute_channel(ctx=ctx, member=member, reason=reason))
        if (not (await self.send_muted_dm_embed(ctx=ctx, member=member, channel=channel, reason=reason))):
            embed.add_field(name='Notice:', value=f'Unable to message {member.mention} about this action. This can be caused by the user not being in the server, having DMs disabled, or having the bot blocked.')
        (await self.mute_member(ctx=ctx, member=member, reason=reason))
        (await ctx.send(embed=embed))
        return
    (duration_string, mute_end_time) = utils.duration.get_duration(duration=duration)
    if (not duration_string):
        (await embeds.error_message(ctx=ctx, description=f'Duration syntax: `#d#h#m#s` (day, hour, min, sec)
You can specify up to all four but you only need one.'))
        return
    embed = embeds.make_embed(ctx=ctx, title=f'Muting member: {member}', thumbnail_url='https://i.imgur.com/rHtYWIt.png', color='soft_red')
    embed.description = f'{member.mention} was muted by {ctx.author.mention} for: {reason}'
    embed.add_field(name='Duration:', value=duration_string, inline=False)
    channel = (await self.create_mute_channel(ctx=ctx, member=member, reason=reason, duration=duration_string))
    if (not (await self.send_muted_dm_embed(ctx=ctx, member=member, channel=channel, reason=reason, duration=duration_string))):
        embed.add_field(name='Notice:', value=f'Unable to message {member.mention} about this action. This can be caused by the user not being in the server, having DMs disabled, or having the bot blocked.')
    (await self.mute_member(ctx=ctx, member=member, reason=reason, temporary=True, end_time=mute_end_time.timestamp()))
    (await ctx.send(embed=embed))