Skip to content

Commit 1a0260a

Browse files
authored
Added text display support to modal (#1515)
1 parent 969a818 commit 1a0260a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/dpp/events/interaction_create.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ std::string internal_handle_interaction(cluster* creator, uint16_t shard_id, jso
169169
fs.custom_id = string_not_null(&(d["data"]), "custom_id");
170170
fs.command = i;
171171
for (auto & c : d["data"]["components"]) {
172-
fs.components.push_back(dpp::component().fill_from_json(&c.at("component")));
172+
if(c.contains("component")){
173+
fs.components.push_back(dpp::component().fill_from_json(&c["component"]));
174+
}
173175
}
174176
if (from_webhook) {
175177
fs.from_webhook = true;

src/dpp/slashcommand.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,10 @@ json interaction_modal_response::to_json_impl(bool with_id) const {
885885
j["data"]["components"] = json::array();
886886
for (auto & row : components) {
887887
for (auto & component : row) {
888+
if(component.type == cot_text_display){
889+
j["data"]["components"].push_back(component);
890+
continue;
891+
}
888892
json sn;
889893
sn["type"] = cot_label;
890894
sn["label"] = component.label;

0 commit comments

Comments
 (0)