Бот дискорд не видит кнопки в сообщении

Я пишу функцию голосования для своего бота дискорд, проблема заключается в том, что бот не видит кнопку, дискорд выдает ошибку взаимодействия.

import discord
from discord.ext import commands
from discord_components import DiscordComponents, Button, ButtonStyle
import asyncio
from config.config import settings
componentss = []

bot = commands.Bot(command_prefix = "-", intents = discord.Intents.all())

class Vote(commands.Cog):

    def __init__(self, bot):

        self.bot = bot

    @commands.command(name = 'StartVote', aliases = ['Голосование', 'голосование', 
'Vote', 'vote'])
    async def __StartVote(self, ctx, *,  msg: str):
        msg_content = msg.split()
        print(msg_content)
        vote_name = msg_content[0]
        msg_content.pop(0)
        for i in range(len(msg_content)):
            comp = Button(style = ButtonStyle.green, label = msg_content[i])
            componentss.append(comp)
        await ctx.send(
            embed = discord.Embed(title = vote_name, colour = discord.Color.green()),
            components = componentss)
        res = await bot.wait_for("button_click")
        if res.component.label == msg_content[0]:
            print("YES")




def setup(bot):
    bot.add_cog(Vote(bot))

Что я делаю не так ?


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