discord.errors.InvalidArgument: components must be a list of Component
Делаю Discord бота с кнопками, но как только запускаю его - ругается на список с кнопками. Просьба помочь, т.к. обыскал почти все. Код снизу.
import discord
from discord.ext import commands
from dislash import InteractionClient
from discord_components import DiscordComponents, Button, ButtonStyle
client = commands.Bot(command_prefix="!")
inter_client = InteractionClient(client)
@client.event
async def on_ready():
print('включено!')
DiscordComponents(inter_client)
@inter_client.slash_command(description="Начать покупку.")
async def start(ctx):
embed=discord.Embed(title="Главное меню", description="Выберите категорию")
embed.set_thumbnail(url="https://cdn.discordapp.com/avatars/604620332967657472/a_33fe6b55b52acb9402bc142ce45b934f.gif")
buttons = [
Button(style = ButtonStyle.blue, label = '? Магазин'),
Button(style = ButtonStyle.blue, label = '? Профиль'),
Button(style = ButtonStyle.blue, label = '? Поддержка')
]
msg = await ctx.send(embed=embed, components=buttons)
client.run("токен")```
Ответы (1 шт):
Автор решения: SanPlay
→ Ссылка
попробуй так, исправил тебе несколько ошибок
import discord
from discord.ext import commands
from dislash import InteractionClient
from discord_components import DiscordComponents, Button, ButtonStyle
client = commands.Bot(command_prefix="!")
inter_client = InteractionClient(client)
@client.event
async def on_ready():
print('включено!')
DiscordComponents(inter_client)
@inter_client.slash_command(description="Начать покупку.")
async def start(ctx):
await stx.send(
embed=discord.Embed(title="Главное меню", description="Выберите категорию")
embed.set_thumbnail(url="https://cdn.discordapp.com/avatars/604620332967657472/a_33fe6b55b52acb9402bc142ce45b934f.gif")
components=[
Button(style = ButtonStyle.blue, label = '? Магазин'),
Button(style = ButtonStyle.blue, label = '? Профиль'),
Button(style = ButtonStyle.blue, label = '? Поддержка')
]
)
client.run("токен")```