| 150 | constexpr auto kTopicsSearchMinCount = 1; |
| 151 | |
| 152 | void ShareBotGame( |
| 153 | not_null<UserData*> bot, |
| 154 | not_null<Data::Thread*> thread, |
| 155 | const QString &shortName) { |
| 156 | auto &histories = thread->owner().histories(); |
| 157 | const auto history = thread->owningHistory(); |
| 158 | const auto randomId = base::RandomValue<uint64>(); |
| 159 | const auto replyTo = thread->topicRootId(); |
| 160 | const auto topicRootId = replyTo; |
| 161 | auto flags = MTPmessages_SendMedia::Flags(0); |
| 162 | if (replyTo) { |
| 163 | flags |= MTPmessages_SendMedia::Flag::f_reply_to; |
| 164 | } |
| 165 | histories.sendPreparedMessage( |
| 166 | history, |
| 167 | FullReplyTo{ |
| 168 | .messageId = { replyTo ? history->peer->id : 0, replyTo }, |
| 169 | .topicRootId = topicRootId, |
| 170 | }, |
| 171 | randomId, |
| 172 | Data::Histories::PrepareMessage<MTPmessages_SendMedia>( |
| 173 | MTP_flags(flags), |
| 174 | history->peer->input(), |
| 175 | Data::Histories::ReplyToPlaceholder(), |
| 176 | MTP_inputMediaGame( |
| 177 | MTP_inputGameShortName( |
| 178 | bot->inputUser(), |
| 179 | MTP_string(shortName))), |
| 180 | MTP_string(), |
| 181 | MTP_long(randomId), |
| 182 | MTPReplyMarkup(), |
| 183 | MTPVector<MTPMessageEntity>(), |
| 184 | MTPint(), // schedule_date |
| 185 | MTPint(), // schedule_repeat_period |
| 186 | MTPInputPeer(), // send_as |
| 187 | MTPInputQuickReplyShortcut(), |
| 188 | MTPlong(), |
| 189 | MTPlong(), |
| 190 | MTPSuggestedPost() |
| 191 | ), [=](const MTPUpdates &, const MTP::Response &) { |
| 192 | }, [=](const MTP::Error &error, const MTP::Response &) { |
| 193 | history->session().api().sendMessageFail(error, history->peer); |
| 194 | }); |
| 195 | } |
| 196 | |
| 197 | } // namespace |
| 198 |
no test coverage detected