Z
Z
Zakkaru2021-12-14 23:37:51
Python
Zakkaru, 2021-12-14 23:37:51

How do I create a mute command?

I want to make the command work on replying a message, that is, a person wrote a bad message, the admin replied to the message with the .ban command without a tag and wrote that Moder: nickname Banned: nickname

@client.command(aliases=["м","m"])
async def мьют(ctx, member: discord.Member = None, time: str=None, reason=None):

    time_in_s = 0

    if time[len(time)-1:] == "с":
        time_in_s = int(time[:len(time)-1])

    elif time[len(time)-1:] == "м":
        time_in_s = int(time[:len(time)-1]) * 60

    elif time[len(time)-1:] == "ч":
        time_in_s = int(time[:len(time)-1]) * 60 * 60

    elif time[len(time)-1:] == "д":
        time_in_s = int(time[:len(time)-1]) * 60 * 60 * 24

    else:
        time_in_s = int(time[:len(time)-1])

    role = discord.utils.get(ctx.guild.roles,id=864088962851012650)

    emb = discord.Embed(title='Вердикт', color=discord.Colour.gold())

    emb.add_field(name='Великий модератор', value=ctx.message.author.mention, inline=False)
    emb.add_field(name='Замьютил', value=member.mention, inline=False)
    emb.add_field(name='По причине', value=reason, inline=False)
    emb.add_field(name='На', value=time, inline=False)

    await member.add_roles(role)

    msg = await ctx.send(embed=emb)

    await msg.add_reaction("✅")

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question