I am using the code below and i need to pass the "message_id" to the Modal, how do i do that?
Here is the modal:
class Name(nextcord.ui.Modal):
def __init__(self, message_id) -> None:
super().__init__(
"Title",
timeout=900
)
self.question = nextcord.ui.TextInput(
label="Question?",
min_length=1,
max_length=500,
required=True,
placeholder="PlaceHolder"
)
self.add_item(self.question)
async def callback(self, interaction: nextcord.Interaction) -> None:
print("I works")
And here is the button:
class button(nextcord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@nextcord.ui.button(
label="Button",
style=nextcord.ButtonStyle.green,
custom_id="button:green"
)
async def button(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
message_id= interaction.message.id
await interaction.response.send_modal(Name())