#How do I edit a response more than once?

1 messages · Page 1 of 1 (latest)

tawny light
#

await interaction.response.edit_message(view=self, embeds=embeds)

discord.errors.InteractionResponded: This interaction has already been responded to before

prisma tigerBOT
#

simplebot/cogs/simple.py line 41

await response.edit_original_message(content="flipping |")```
tawny light
hollow voidBOT
#

It's tails

tawny light
heavy pagoda
#

Can you send your code

tawny light
# heavy pagoda Can you send your code

`import discord

from discord import Bot
from discord.ui import Item

TOKEN = ""

BOT = Bot()

class TestView(discord.ui.View):

def __init__(self, *items: Item):

    super().__init__(*items)

@discord.ui.button(label="START", style=discord.ButtonStyle.green)
async def start(self, button: discord.ui.Button, interaction: discord.Interaction):
    for i in range(2):
        await interaction.response.edit_message(view=self, content=f'INDEX-{i}')
        #await interaction.response.edit_original_message(view=self, content=f'INDEX-{i}')

@BOT.slash_command(name="test", description="")
async def _test(ctx):
testView = TestView()
await ctx.respond(ephemeral=True, view=testView, content='PRESS START')

BOT.run(TOKEN)
`

echo lance
#

its await interaction.edit_original_message()

tawny light
# echo lance its `await interaction.edit_original_message()`

Doesn't work ;c

await interaction.edit_original_message(view=self, content=f'INDEX-{i}')

`Traceback (most recent call last):
File "discord_bot\venv\lib\site-packages\discord\ui\view.py", line 371, in scheduled_task
await item.callback(interaction)
File "discord_bot\test_bot2.py", line 21, in start
await interaction.edit_original_message(view=self, content=f'INDEX-{i}')
File "discord_bot\venv\lib\site-packages\discord\interactions.py", line 375, in edit_original_message
data = await adapter.edit_original_interaction_response(
File "discord_bot\venv\lib\site-packages\discord\webhook\async
.py", line 211, in request
raise NotFound(response, data)

discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook`

cloud crown
#

Hey, you could use interaction.message.edit()

#

@tawny light keep in mind that you still need to respond to the interaction with interaction.response.edit_message() if you use the approach above

#

this does not work with ephemeral messages i think

tawny light
# cloud crown Hey, you could use `interaction.message.edit()`

`File "discord_bot\test_bot2.py", line 20, in start
await interaction.message.edit(view=self, content=f'INDEX-{i}')
File "discord_bot\venv\lib\site-packages\discord\message.py", line 1388, in edit
data = await self._state.http.edit_message(self.channel.id, self.id, **payload)
File "discord_bot\venv\lib\site-packages\discord\http.py", line 355, in request
raise NotFound(response, data)

discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message`

tawny light
umbral hatch
#

dont you need to followup?

#

im not sure, havent ever needed to respond twice to an interaction

frigid breach
fossil sparrow
#

ephemeral messages are fake messages, they aren't stored on discord's end so you cannot edit them.

#

They are sent to the client that interacted. E.g if you interact on PC, you wont see the message on your phone. They aren't synced

#

It's the same reason delete_after doesn't work on them

cyan lantern
heavy pagoda
fossil sparrow
#

Oh damn, they must have fixed that. That's my bad.

heavy pagoda
#

specifically desktop -> mobile

#

but not the other way around

#

and I have an ephemeral paginator, which is definitely editing the message 😄

fossil sparrow
#

Well I figured it out

#

I think

#
inter = await interaction.response.send_message("First Response", ephemeral=True)
msg = await inter.original_message()
await msg.edit("Edit Response")
#

@tawny light

sent_interaction = None
for i in range(2):
  if i == 0:
    sent_interaction = await interaction.response.send_message(f'INDEX-{i}', ephemeral=True)
  else:
    msg = await sent_interaction.original_message()
    await msg.edit(f'INDEX-{i}')
tawny light