MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / SuggestMessageOrMedia

Function SuggestMessageOrMedia

Telegram/SourceFiles/api/api_editing.cpp:245–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243
244template <typename DoneCallback, typename FailCallback>
245mtpRequestId SuggestMessageOrMedia(
246 not_null<HistoryItem*> item,
247 const TextWithEntities &textWithEntities,
248 Data::WebPageDraft webpage,
249 SendOptions options,
250 DoneCallback &&done,
251 FailCallback &&fail,
252 std::optional<MTPInputMedia> inputMedia) {
253 const auto wasMedia = item->media();
254 if (!inputMedia && wasMedia && wasMedia->allowsEditCaption()) {
255 if (const auto photo = wasMedia->photo()) {
256 inputMedia = MTP_inputMediaPhoto(
257 MTP_flags(0),
258 photo->mtpInput(),
259 MTPint(), // ttl_seconds
260 MTPInputDocument()); // video
261 } else if (const auto document = wasMedia->document()) {
262 inputMedia = MTP_inputMediaDocument(
263 MTP_flags(0),
264 document->mtpInput(),
265 MTPInputPhoto(), // video_cover
266 MTPint(), // video_timestamp
267 MTPint(), // ttl_seconds
268 MTPstring()); // query
269 }
270 }
271 if (inputMedia) {
272 return SuggestMedia(
273 item,
274 textWithEntities,
275 webpage,
276 options,
277 std::move(done),
278 std::move(fail),
279 inputMedia);
280 }
281 return SuggestMessage(
282 item,
283 textWithEntities,
284 webpage,
285 options,
286 std::move(done),
287 std::move(fail));
288}
289
290template <typename DoneCallback, typename FailCallback>
291mtpRequestId EditMessage(

Callers 1

EditMessageFunction · 0.85

Calls 8

MTP_flagsFunction · 0.85
SuggestMediaFunction · 0.85
SuggestMessageFunction · 0.85
allowsEditCaptionMethod · 0.80
mediaMethod · 0.45
photoMethod · 0.45
mtpInputMethod · 0.45
documentMethod · 0.45

Tested by

no test coverage detected