@vladislavlisitsyn

Почему не работает код?

Написал код:
class Acracc(disnake.ui.Modal):
    def __init__(self):
        components = [
            disnake.ui.TextInput(
                label='Confirm code',
                placeholder='Code',
                custom_id='code1',
                style=TextInputStyle.short,
                min_length=4,
                max_length=4
            )
        ]
        super().__init__(
            title='Confirm',
            components=components,
            custom_id='conf',
            timeout=1200
        )

    async def callback(self, inter: disnake.ModalInteraction):
        if inter.text_values['code1'] == '7573':
            channel = client.get_channel(1008433669179986041)
            list = cur.execute('SELECT top, nick, userid FROM activity').fetchall()
            list = tuple(sorted(list, reverse=True))
            n = 1
            for i in list:
                print(f'{n}. {i[1]} — {i[0]} баллов')
                await channel.send(f'{n}. <@{i[2]}> ({i[1]}) — {i[0]} баллов')
                n += 1
            await inter.response.defer()
            await asyncio.sleep(10)
            await inter.followup.send('Посмотрите канал <#1008433669179986041>', ephemeral=True)
        else:
            await inter.response.send_message(embed=disnake.Embed(title='[ERROR] Wrong code', description='Ошибка [2%ds#2] (неверный код)'), ephemeral=True)



              
@client.slash_command(description='Список активности')
async def actlist(inter):
    role1 = disnake.utils.get(inter.guild.roles, id=909887088890114058)
    role2 = disnake.utils.get(inter.guild.roles, id=838355881242263562)
    if role1 in inter.author.roles or role2 in inter.author.roles:
        await inter.response.send_modal(modal=Acracc())
    else:
        await inter.send(embed=disnake.Embed(title='[ERROR] Activity', description='У вас нет доступа к этой команде'), ephemeral=True)

Но выдаёт ошибку
File "main.py", line 378, in callback
    await inter.response.defer()
disnake.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
  • Вопрос задан
  • 53 просмотра
Пригласить эксперта
Ваш ответ на вопрос

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

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