Нужно чтобы по нажатию кнопки disnake менялось вложение в сообщении (дискорд бот)

Задача такая. По отправке команды /screen дискорд боту на Disnake бот отправляет скриншот с кнопкой перезагрузки скриншота. Нужно, чтобы по ее нажатию выполнялась данная функция, но выходит ошибка: raise CommandInvokeError(exc) from exc disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: InteractionResponded: This interaction has already been responded to before Код:


import disnake
from disnake import guild
import pyautogui as pg
from disnake import File
from datetime import timezone, datetime, timedelta

bot = commands.InteractionBot(test_guilds=[id сервера], intents=disnake.Intents.all())

@bot.slash_command(description="Screenshoting the display")
async def screen(inter: disnake.ApplicationCommandInteraction):
   while True:
      view = disnake.ui.View()
      item = disnake.ui.Button(style=disnake.ButtonStyle.blurple, label="Новый скриншот")
      pg.screenshot('screen.png')
      file1=disnake.File('screen.png')
      dt=datetime.now().strftime("Дата: %d/%m/%Y, время: %H:%M:%S")
      view.add_item(item=item)
      await inter.response.send_message(file=file1, content=f'Скриншот ({dt}):', view=view)
      bot.wait_for('button_click')```

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