@Forraz

Почему по нажатию кнопки возникает ошибка взаимодействия?

@bot.command()
async def test(ctx):
    await ctx.send(
        embed = discord.Embed(title = 'Выбери роль.', timestamp = date),
        components = [
            Button(label="Роль1", custom_id='one'),
            Button(label="Роль2", custom_id='two')
        ])
    while True:
        responce = await bot.wait_for('button_click')
        guild = bot.get_guild(responce.guild.id)
        user = responce.author
        if responce.component.id == 'one':
            role = guild.get_role(952534698754732083)
            print(role, type(role))
            await user.add_roles(role)
        elif responce.component.id == 'two':
            role = guild.get_role(953317438462763150)
            await user.add_roles(role)

Роль выдаётся, но ошибка всё еще присутствует.
Использую discord-components.
  • Вопрос задан
  • 102 просмотра
Пригласить эксперта
Ваш ответ на вопрос

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

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