G
G
GoosIDK2021-11-03 15:00:21
Python
GoosIDK, 2021-11-03 15:00:21

How to make a bot that accepts applications and the admin accepted by clicking on the buttons and the person was given a role?

@slash.slash(name = 'inv', description = 'Заявка"',
options = [{'name': "test", 
                'description': "Test cmd", 
                'type': 3, 
                'requied': True},
                ])
async def __inv__(ctx, test):
role = guild.get_role('904345147322544129')
    msg = await ctx.send(
        embed = discord.Embed(title = f'<@{ctx.author.id}>' ,embed = discord.Embed(title = 'Новая заявка!',description = f'**```{test}```**'),
        components = [
            Button(style = ButtonStyle.blue, label = 'Принять'),
            Button(style = ButtonStyle.red, label = 'Отклонить'),
        ])
    responce = await client.wait_for('button_click', check = lambda message: message.author == ctx.author)
    if responce.component.label == 'Отклонить':
        await ctx.author.send(embed = discord.Embed(description = f'Приветствую {ctx.author.name}, вашу заявку отклонили!', color=0x4169E1))
    else:
       await ctx.author.add_roles(role)

The essence of this bot is to accept people, and when the administrator accepts people by clicking on the button, the person who wrote the application is given a role and
gives an error:
File "main.py", line 199
response = await client.wait_for('button_click', check = lambda message: message .author == ctx.author)
^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2021-11-03
@DMGarikk

role = guild.get_role - no indent
ps and respon s e - not an error of course from a programming point of view, but the eye clings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question