Задать вопрос
@GoosIDK

Ошибка 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)

Ошибка:
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'
  • Вопрос задан
  • 121 просмотр
Подписаться 1 Простой 1 комментарий
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы