2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Game play send message action is supported.

This commit is contained in:
John Preston
2016-09-30 16:40:22 +03:00
parent 376941dd5e
commit a18e3e5616
7 changed files with 125 additions and 39 deletions

View File

@@ -3454,6 +3454,7 @@ void HistoryWidget::updateSendAction(History *history, SendActionType type, int3
case SendActionUploadFile: action = MTP_sendMessageUploadDocumentAction(MTP_int(progress)); break;
case SendActionChooseLocation: action = MTP_sendMessageGeoLocationAction(); break;
case SendActionChooseContact: action = MTP_sendMessageChooseContactAction(); break;
case SendActionPlayGame: action = MTP_sendMessageGamePlayAction(); break;
}
_sendActionRequests.insert(qMakePair(history, type), MTP::send(MTPmessages_SetTyping(history->peer->input, action), rpcDone(&HistoryWidget::sendActionDone)));
if (type == SendActionTyping) _sendActionStopTimer.start(5000);
@@ -5817,7 +5818,8 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button
}
void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotCallbackAnswer &answer, mtpRequestId req) {
if (auto item = App::histItemById(info.msgId)) {
auto item = App::histItemById(info.msgId);
if (item) {
if (auto markup = item->Get<HistoryMessageReplyMarkup>()) {
if (info.row < markup->rows.size() && info.col < markup->rows.at(info.row).size()) {
if (markup->rows.at(info.row).at(info.col).requestId == req) {
@@ -5842,6 +5844,7 @@ void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotC
if (info.game) {
url = appendShareGameScoreUrl(url, info.msgId);
BotGameUrlClickHandler(info.bot, url).onClick(Qt::LeftButton);
updateSendAction(item->history(), SendActionPlayGame);
} else {
UrlClickHandler(url).onClick(Qt::LeftButton);
}