G
G
GoosIDK2021-11-03 20:09:41
Python
GoosIDK, 2021-11-03 20:09:41

AttributeError: 'Button' object has no attribute 'get'?

@slash.slash(name = 'invg', description = 'Заявка"',
options = [{'name': "test", 
                'description': "Test cmd", 
                'type': 3, 
                'requied': True},
                ])
async def __invg__(ctx, test):
    role = ('904345147322544129')
    msg = await ctx.send(
    embed = discord.Embed(title = 'Новая заявка!',description = f'**```{test}```**'),
    components = [
        Button(style = ButtonStyle.green, 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)

Mistake:
An exception has occurred while executing command `invg`:
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord_slash\client.py", line 1352, in invoke_command
    await func.invoke(ctx, **args)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord_slash\model.py", line 210, in invoke
    return await self.func(*args, **kwargs)
  File "main.py", line 197, in __invg__
    Button(style = ButtonStyle.red, label = 'Отклонять')
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord_slash\context.py", line 215, in send
    if components and not all(comp.get("type") == 1 for comp in components):
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord_slash\context.py", line 215, in <genexpr>
    if components and not all(comp.get("type") == 1 for comp in components):
AttributeError: 'Button' object has no attribute 'get'

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