async def auto_hardmute(cmd, pld, target):
    """
    Auto-Hardmutes a user and logs it appropriately.
    :param cmd:
    :type cmd: sigma.core.mechanics.command.SigmaCommand
    :param pld:
    :type pld: sigma.core.mechanics.payload.CommandPayload
    :type target: discord.Member
    """
    await notify(pld, target, 'on', 'hard-muted')
    for channel in pld.msg.guild.channels:
        if isinstance(channel, discord.TextChannel) or isinstance(
                channel, discord.CategoryChannel):
            try:
                await channel.set_permissions(target,
                                              send_messages=False,
                                              add_reactions=False)
            except (discord.Forbidden, discord.NotFound):
                pass
    # importing locally to avoid function name confusion/overwrites
    from sigma.modules.moderation.punishments.hardmute import generate_log_embed
    # spoof the message author as Sigma (feels wrong but hey, it works)
    pld.msg.author = pld.msg.guild.me
    log_embed = generate_log_embed(pld.msg, target, 'Auto-Punished by Sigma')
    await log_event(cmd.bot, pld.settings, log_embed, 'log_mutes')
async def auto_ban(cmd, pld, target):
    """
    Auto-Bans a user and logs it appropriately.
    :param cmd:
    :type cmd: sigma.core.mechanics.command.SigmaCommand
    :param pld:
    :type pld: sigma.core.mechanics.payload.CommandPayload
    :type target: discord.Member
    """
    await notify(pld, target, 'from', 'banned')
    await target.ban(reason='Auto-Punished by Sigma', delete_message_days=1)
    # importing locally to avoid function name confusion/overwrites
    from sigma.modules.moderation.punishments.ban import generate_log_embed
    # spoof the message author as Sigma (feels wrong but hey, it works)
    pld.msg.author = pld.msg.guild.me
    log_embed = generate_log_embed(pld.msg, target, 'Auto-Punished by Sigma')
    await log_event(cmd.bot, pld.settings, log_embed, 'log_kicks')
async def auto_textmute(cmd, pld, target):
    """
    Auto-Textmutes a user and logs it appropriately.
    :param cmd:
    :type cmd: sigma.core.mechanics.command.SigmaCommand
    :param pld:
    :type pld: sigma.core.mechanics.payload.CommandPayload
    :type target: discord.Member
    """
    mute_list = pld.settings.get('muted_users') or []
    if target.id not in mute_list:
        await notify(pld, target, 'on', 'text-muted')
        mute_list.append(target.id)
        await cmd.db.set_guild_settings(pld.msg.guild.id, 'muted_users',
                                        mute_list)

        # importing locally to avoid function name confusion/overwrites
        from sigma.modules.moderation.messages.textmute import generate_log_embed
        # spoof the message author as Sigma (feels wrong but hey, it works)
        pld.msg.author = pld.msg.guild.me
        log_embed = generate_log_embed(pld.msg, target,
                                       'Auto-Punished by Sigma')
        await log_event(cmd.bot, pld.settings, log_embed, 'log_mutes')