disnake ошибка с components

import disnake
from disnake.ext import commands
from disnake.ui import Button

PREFIX = "/"

bot = commands.Bot(command_prefix=PREFIX, intents=disnake.Intents.all())

@bot.event
async def on_ready():
    print("bot connected")

buttons = [
    [
        Button(style=disnake.ButtonStyle.gray, label="7"),
        Button(style=disnake.ButtonStyle.gray, label="8"),
        Button(style=disnake.ButtonStyle.gray, label="9"),
        Button(style=disnake.ButtonStyle.blurple, label="/")
    ],
    [
        Button(style=disnake.ButtonStyle.gray, label="4"),
        Button(style=disnake.ButtonStyle.gray, label="5"),
        Button(style=disnake.ButtonStyle.gray, label="6"),
        Button(style=disnake.ButtonStyle.blurple, label="*")
    ],
    [
        Button(style=disnake.ButtonStyle.gray, label="1"),
        Button(style=disnake.ButtonStyle.gray, label="2"),
        Button(style=disnake.ButtonStyle.gray, label="3"),
        Button(style=disnake.ButtonStyle.blurple, label="-")
    ],
    [
        Button(style=disnake.ButtonStyle.gray, label="."),
        Button(style=disnake.ButtonStyle.gray, label="0"),
        Button(style=disnake.ButtonStyle.green, label="="),
        Button(style=disnake.ButtonStyle.blurple, label="+")
    ]
]

@bot.command()
async def calc(ctx):
    main = await ctx.send(content="Loading...")
    emb = disnake.Embed(title="Calculator")
    await main.edit(components=buttons, embed=emb)
    expression = ''

    while True:
        event = await bot.wait_for("button_click")
        expression += event.component.label
        emb.title = expression
        await main.edit(embed=emb)

Когда запускаю код, и ввожу команду, появляется вот такая ошибка

disnake.ext.commands.errors.CommandInvokeError: Command raised an exception:
TypeError: _edit_handler() got an unexpected keyword argument 'components'

И даже если я просто components передаю в send, такая же ошибка. Как это исправить?


Ответы (0 шт):