M
M
multiapi2020-08-01 12:32:41
Python
multiapi, 2020-08-01 12:32:41

Issuing roles to a specific role on command?

There is a command to request a role. I don't understand how to set some functions for reactions.

@client.command()
async def role( ctx):

    role = ctx.guild.get_role(
        703596629860548643
    )  

    zapros_chanell = client.get_channel( 729733881129074768 ) 
    zapros2_chanell = client.get_channel( 703596629923725339 ) 
    embed = discord.Embed(title="Запрос роли")
    embed.add_field(name='Запросивший роль', value=ctx.message.author.mention)
    embed.add_field(name='Роль для выдачи', value=f'{role.mention}' )

    embed.set_thumbnail(url=ctx.guild.icon_url)

    message = await zapros_chanell.send(embed=embed)
    await zapros2_chanell.send(embed = discord.Embed(description = f'{ctx.message.author.mention}, `запрос на выдачу роли был успешно отправлен, ожидайте его рассмотрения модерацией Discord`', color=discord.Color.purple()))
    await message.add_reaction('✅')
    await message.add_reaction('❎')


The bottom line is that if, when you click on ✅, the role was given out and a text was written to the person in zapros2_chanell.

When clicking on ❎ the role was not given to the person, therefore, a certain text was also written in zapros2_chanell.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
multiapi, 2020-08-04
@multiapi

Everything, I guessed).

@client.command()
async def role(ctx):
    await ctx.send(f"{ctx.author.mention}, `запрос на роль был успешно отправлен, ожидайте рассмотрение запроса модерацией.`")
    chatmoder = client.get_channel( 729733881129074768 )
    confirm_msg = await chatmoder.send(f"{ctx.author.mention} запрашивает роль")
    await confirm_msg.add_reaction("")
    await confirm_msg.add_reaction("") 
    role = ctx.guild.get_role(703596629860548643)  
        
    try:
        reaction, user = await client.wait_for('reaction_add', timeout=1800.0)
    except asyncio.TimeoutError:
        await ctx.send("Время ожидание прошло. Попросите руководителя семьи еще раз приглосить Вас в семью")
    else:
        if str(reaction) == "":
            await ctx.author.add_roles(role)
            await ctx.send("Роль выдана.")
        else:
            await ctx.send("Роль не выдана.")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question