#how can i fetch for an interaction by its token

1 messages · Page 1 of 1 (latest)

calm owl
#

Basically what i am trying to do is get the interaction by its token (not id) then edit it. I've been seeking for it on docs but didn't find any

open plover
#

What do you mean edit it?

calm owl
open plover
#

edit the response?

calm owl
#

Ye

open plover
#

inter.edit_original_response

#

-d disnake.ApplicationCommandInteraction

humble sedgeBOT
#

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.
calm owl
open plover
#

Then I'll need more context.

calm owl
#

wait gimme a sec

calm owl
# open plover Then I'll need more context.

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

open plover
#

Then you need to pass the original message/response

#

view= ViewOne()
await inter.response.send_message(view=view)

view.message = await inter.original_response()

calm owl
#

Hol up

open plover
#

Becuase you still have to respond to the interaction.

calm owl
#

Lemme show u the code. It will explain everything

open plover
#

Yes please.

calm owl
#

whats the name of that website

#

Which allows u to post code

#

I forgot its name

open plover
calm owl
open plover
#
class SelectWhitelistsMenuOptions(StringSelect):
   def __init__(self, whitelist_type: str):

But you're passing in ctx

calm owl
#

that is not the issue

open plover
#

ctx is commands.Context

calm owl
open plover
#

So you're passing in an instance of Contxt but you have it typed as a str

open plover
#

Yes..

#

based on what you just sent

calm owl
#

😭u probably saw the SelectWhitelistMenuOptions

calm owl
#

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)

open plover
#

Yeah..

#

this isn't confusing at all. One sec

calm owl
#

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

open plover
#

view.message = await inter.send(embed = em, view = view, ephemeral= True)

open plover
#

interactions do not return a message object

calm owl
open plover
#

same concept as this

calm owl
#

Are u on ur laptop/pc?

open plover
#

Yes..

calm owl
calm owl
calm owl
#

If it works

open plover
#

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..

open plover
#

You're trying to edit the message sent by view one, in view two, correct?

open plover
#

pass the message to it correctly, and you'll be able to.

calm owl
#

How😭😭

#

I must be slow at this point

open plover
#

You literally have the code there, just fix it like I've told you to do.. twice

calm owl
#

Anyways can u rate my code tho

#

Cuz i've been "trying" to code a cleaner code

open plover
#
      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()
calm owl
#

Does that look like a clean code to u?

open plover
#

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

calm owl
#

Thanks for guiding/helping me. Imma eat rn. Ill let you know once i fix it

#

Appreciate you for ur efforts

calm owl
#

Thanks @open plover you're the best!

open plover
#

Sure thing. Please make sure to use /solved to close this thread.