@Neisvestniy

Почему ругается на dislash?

@bot.event
    async def on_button_click(inter):
      await inter.respond(type=5)
      guild= bot.get_guild(inter.guild.id)
  

      buttons= {
        "verif_button": 911731057253040168,
        "1_button": 918176069893369877,
        "2_button": 918176099840704533,
        "3_button": 918187820017926166,
        "4_button": 918187829861969992,
        "5_button": 918187834396000318}


      for i in buttons:
        if inter.component.id == i:
          for j in buttons:
            if i != j:
              await inter.author.remove_roles(guild.get_role(buttons[j]))
          await inter.author.add_roles(guild.get_role(buttons[i]))
          break
        msg_list= [
          '**Обработка...**\n`⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛`',
          f'**Обработка участника {inter.author.name}...**\n`⬜⬜⬜⬜⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛`',
          f'**Обработка участника {inter.author.name}...**\n`⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬛⬛`',
              '**Выдача роли...**\n`⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛`',
          '**Завершение...**\n`⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜`',      '**Завершение...**\n`⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜`']

        msg = await inter.channel.send(msg_list[0])
        for i in range(5):
          await asyncio.sleep(float(random.randint(0, 15))/15)
          await msg.edit(msg_list[i])
        await msg.delete() 

    @bot.command()
    async def role(ctx):
      white_list = (969585233412374568,  969941034538786897)
      test = False
      for i in ctx.author.roles:
        if i.id in white_list:

            test = True

            emb = discord.Embed(
                description = 
                f"""
                Выберите роли:
                ```Внимание! Не беспокойтесь если загрузка слишком долгая, дождитесь повторной загрузки выдачи. это связанно с тем что бот соеденяется с серверами и проверяет вас бот ли вы или нет!```
                """,
                colour = 000000
            )
            emb.set_image(url = 'https://pt-blog.ru/wp-content/uploads/2018/10/1.gif')
            emb.set_author(name = 'Роли')
            row = ActionRow(
                Button(
                    style = ButtonStyle.green,
                    label = '1',
                    custom_id = '1_button'
              
                ),
                Button(
                    style = ButtonStyle.green,
                    label = '2',
                    custom_id = '2_button'
                ),
                Button(
                    style = ButtonStyle.green,
                    label = '3',
                    custom_id = '3_button',
                ), 
                Button(
                    style = ButtonStyle.green,
                    label = '4',
                    custom_id = '4_button',
                ),
                Button(
                    style = ButtonStyle.green,
                    label = '5',
                    custom_id = '5_button',
                )
            )
            await ctx.send(embed = emb, components = [row])
        if test is False:
            await ctx.send(f'{ctx.author.mention} у вас нет разрешающей роли для использования данной команды!')


ошибка:
File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 1349, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 1023, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "C:\Users\USER\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 238, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: send() got an unexpected keyword argument 'components'
  • Вопрос задан
  • 60 просмотров
Пригласить эксперта
Ваш ответ на вопрос

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

Войти через центр авторизации
Похожие вопросы