diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp index ed19aa805..0755e7c7f 100644 --- a/Telegram/SourceFiles/api/api_sending.cpp +++ b/Telegram/SourceFiles/api/api_sending.cpp @@ -229,7 +229,10 @@ void SendExistingPhoto( forwarding); } -bool SendDice(Api::MessageToSend &message, Fn doneCallback) { +bool SendDice( + Api::MessageToSend &message, + Fn doneCallback, + bool forwarding) { const auto full = message.textWithTags.text.midRef(0).trimmed(); auto length = 0; if (!Ui::Emoji::Find(full.data(), full.data() + full.size(), &length) @@ -350,7 +353,9 @@ bool SendDice(Api::MessageToSend &message, Fn doneCallback) { ).send(); return history->sendRequestId; }); - api->finishForwarding(message.action); + if (!forwarding) { + api->finishForwarding(message.action); + } return true; } diff --git a/Telegram/SourceFiles/api/api_sending.h b/Telegram/SourceFiles/api/api_sending.h index 1212101db..415a3ea87 100644 --- a/Telegram/SourceFiles/api/api_sending.h +++ b/Telegram/SourceFiles/api/api_sending.h @@ -37,7 +37,10 @@ void SendExistingPhoto( Fn doneCallback = nullptr, bool forwarding = false); -bool SendDice(Api::MessageToSend &message, Fn doneCallback = nullptr); +bool SendDice( + Api::MessageToSend &message, + Fn doneCallback = nullptr, + bool forwarding = false); void FillMessagePostFlags( const SendAction &action, diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 52d4c7324..743a3f1bf 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4063,20 +4063,15 @@ void ApiWrap::forwardMessagesUnquoted( } auto message = ApiWrap::MessageToSend(history); - message.textWithTags = TextWithTags{ - dice->emoji(), - TextWithTags::Tags() - }; + message.textWithTags.text = dice->emoji(); message.action.options = action.options; message.action.clearDraft = false; - auto doneCallback = [=] () { + Api::SendDice(message, [=] { if (shared && !--shared->requestsLeft) { shared->callback(); } - }; - - SendDice(message, std::move(doneCallback)); + }, true); // forwarding }; const auto forwardMessageUnquoted = [&] (not_null item) { @@ -4104,8 +4099,7 @@ void ApiWrap::forwardMessagesUnquoted( if (shared && !--shared->requestsLeft) { shared->callback(); } - }, - true); // forwarding + }, true); // forwarding }; const auto sendAccumulated = [&] {