#How do I edit a response more than once?
1 messages · Page 1 of 1 (latest)
simplebot/cogs/simple.py line 41
await response.edit_original_message(content="flipping |")```
await interaction.response.edit_original_message(view=self, embeds=embeds)
AttributeError: 'InteractionResponse' object has no attribute 'edit_original_message'
It's tails
What version of pycord?
2.0.0b7
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)
`
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`
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
`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`
Eh, I need exactly ephemeral messages ;c
dont you need to followup?
im not sure, havent ever needed to respond twice to an interaction
I dont think u can edit with followup
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
we can edit them, store the message to variable
this is not true, I see them on both, and they're editable.
Oh damn, they must have fixed that. That's my bad.
specifically desktop -> mobile
but not the other way around
and I have an ephemeral paginator, which is definitely editing the message 😄
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}')
Wow, it works! Thank you all so much!