| 25 | } |
| 26 | |
| 27 | static td::int64 get_json_value(nlohmann::json &json, const std::vector<std::string> &sub) { |
| 28 | auto *ptr = &json; |
| 29 | for (const auto &f : sub) { |
| 30 | if (!ptr->is_object()) { |
| 31 | return 0; |
| 32 | } |
| 33 | if (!ptr->contains(f)) { |
| 34 | return 0; |
| 35 | } |
| 36 | ptr = &(*ptr)[f]; |
| 37 | } |
| 38 | if (!ptr->is_number_unsigned()) { |
| 39 | return 0; |
| 40 | } |
| 41 | return ptr->get<td::int64>(); |
| 42 | } |
| 43 | |
| 44 | std::string add_next_answer_slice(td::Slice event) override { |
| 45 | last_ += event.str(); |