#how can i fetch for an interaction by its token
1 messages · Page 1 of 1 (latest)
What do you mean edit it?
Like "edit" message
edit the response?
Ye
class disnake.ApplicationCommandInteraction```
Represents an interaction with an application command.
Current examples are slash commands, user commands and message commands.
New in version 2.1.
Nah im not looking for that
Then I'll need more context.
wait gimme a sec
So basically, i have 2 views. i sent the msg with await inter.send(view = viewNumber2) (on the first view) then the i called the stop function/method. And i wanted to edit the first msg on view 1 inside the view2
I hope you understood what im trying to say
Then you need to pass the original message/response
view= ViewOne()
await inter.response.send_message(view=view)
view.message = await inter.original_response()
On the second view it says that "it didnt even repond to it"
Hol up
Becuase you still have to respond to the interaction.
Lemme show u the code. It will explain everything
Yes please.
A simple paste service run entirely on Cloudflare's edge.
class SelectWhitelistsMenuOptions(StringSelect):
def __init__(self, whitelist_type: str):
But you're passing in ctx
Ctx is a "AnyContext"
that is not the issue
ctx is commands.Context
Ik
So you're passing in an instance of Contxt but you have it typed as a str
😭u probably saw the SelectWhitelistMenuOptions
It is not
Lemme show u
There is 2
Dropdowns aka a sub class of StringSelect
First one has the "STR"
And the second one has AnyConext (ctx/interaction)
The code works fine
Im only stuck in the part where i want to edit an interaction message that has been sent already froma different view
This is why i've been asking for a way to fetch for an interation by its token cuz in the DISCORD.js has this thing so iam 100% disnake has it too
view.message = await inter.send(embed = em, view = view, ephemeral= True)
Yeah thats the ussue
Issue
interactions do not return a message object
Yeah i noticed that when i printed the message
same concept as this
Are u on ur laptop/pc?
Yes..
It wont work tho
Look run the code i sent u
How do you expect me to run the code with all that constants that you've added
If you want to see a simplified, two view, edit message type thing, sure..
Wym
You're trying to edit the message sent by view one, in view two, correct?
Yep
pass the message to it correctly, and you'll be able to.
You literally have the code there, just fix it like I've told you to do.. twice
Alr
Anyways can u rate my code tho
Cuz i've been "trying" to code a cleaner code
view = GoBackView(self.ctx, inter.values[0].lower(), self.view.message)
await self.view.message.edit(view = self.view)
self.view.stop()
view.message = await inter.send(embed = em, view = view, ephemeral= True)
print(view.message)
await inter.send(embed = em, view = view, ephemeral= True)
view.message = await inter.original_response()
Does that look like a clean code to u?
Not easy to follow
but I'd also assume this isn't all in one module, either and you just had to do it for the paste
but you also don't even need all that.
disnake.MessageInteraction has a message attribute that is the message object in which the interaction is associated with.
so, await inter.response.edit_message() would also likely work AND count as an interaction response
you really only need to pass in the message for when you're using an on_timeout that gets no arguments
Thanks for guiding/helping me. Imma eat rn. Ill let you know once i fix it
Appreciate you for ur efforts
Sure thing. Please make sure to use /solved to close this thread.
