send_modal

Let's you send a new modal (the popup) with the specified functions and handler


Please goto builders/components to build new components

builders

Example

local example_modal = {
    custom_id = "modal_id",
    title = "Enter Password",
    components = {{
        type = components["Action Row"]
        components = {{
          type = components["Text Input"]
          custom_id = "example_input",
          style = modal_types.SHORT, -- SHORT or PARAGRAPH
          label = "Password",
          required = true 
        }}
    }}
}

-- send_modal does not take in a handler table and just a function
send_modal(interaction_id, interaction_token, function(info)
  local modal_data = info.modal_data
  local example_input = modal_data["example_input"]
  
  local interaction_id = info.interaction_id
  local interaction_token = info.interaction_token
  
  if example_input == "password123" then   
    update_message(interaction_id, interaction_token, { 
      content = "Entered the correct password",
      components = {} 
    }
  else
    update_message(interaction_id, interaction_token, { 
      content = "Entered the wrong password",
      components = {} 
    }
  end 
end)  

Last updated