Z
Z
Zakkaru2021-07-11 12:37:10
Python
Zakkaru, 2021-07-11 12:37:10

The role is not taken after the elapsed time?

Вот сам код 
@client.command()
@commands.has_any_role(839056048425402379, 859899976536686652,859901211694858240,859901220192780288,859901219631136785)
async def заткнуть(ctx,member:discord.Member,str , *, reason=None):
    author = ctx.message.author
    role = discord.utils.get(ctx.guild.roles,id=863127308810190908)
    await member.add_roles(role)
    emb = discord.Embed(title='Вердикт',colour=discord.Colour.from_rgb(255, 255, 0))
    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=str,inline=False)
    await ctx.send(embed=emb)
    if d == "с":
       await asyncio.sleep(time)
    if d == "м":
       await asyncio.sleep(time*60)
    if d == "ч":
       await asyncio.sleep(time*60*60)
    if d == "д":
       await asyncio.sleep(time*60*60*24)
    await member.remove_roles(role)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Mokhovikov, 2021-07-11
@mohovoy

You don't have d defined in your function . Try to declare like this:

async def заткнуть(ctx, member:discord.Member, d: str , *, reason=None):

There was a similar reason, it helped me personally ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question