mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-01 12:00:48 +00:00
Removed App::sendBotCommand.
This commit is contained in:
parent
a030907598
commit
dcc8a64d37
@ -192,7 +192,7 @@ bool BotKeyboard::moderateKeyActivate(int key) {
|
||||
if (!markup->rows.empty()
|
||||
&& index >= 0
|
||||
&& index < int(markup->rows.front().size())) {
|
||||
App::activateBotCommand(item, 0, index);
|
||||
App::activateBotCommand(_controller, item, 0, index);
|
||||
return true;
|
||||
}
|
||||
} else if (const auto user = item->history()->peer->asUser()) {
|
||||
|
@ -58,15 +58,6 @@ namespace {
|
||||
|
||||
namespace App {
|
||||
|
||||
void sendBotCommand(
|
||||
not_null<PeerData*> peer,
|
||||
UserData *bot,
|
||||
const QString &cmd, MsgId replyTo) {
|
||||
if (const auto m = CheckMainWidget(&peer->session())) {
|
||||
m->sendBotCommand({ peer, /*bot,*/ cmd, FullMsgId(), replyTo });
|
||||
}
|
||||
}
|
||||
|
||||
void hideSingleUseKeyboard(not_null<const HistoryItem*> message) {
|
||||
if (const auto m = CheckMainWidget(&message->history()->session())) {
|
||||
m->hideSingleUseKeyboard(message->history()->peer, message->id);
|
||||
@ -81,6 +72,7 @@ bool insertBotCommand(const QString &cmd) {
|
||||
}
|
||||
|
||||
void activateBotCommand(
|
||||
Window::SessionController *sessionController,
|
||||
not_null<const HistoryItem*> msg,
|
||||
int row,
|
||||
int column) {
|
||||
@ -98,12 +90,15 @@ void activateBotCommand(
|
||||
case ButtonType::Default: {
|
||||
// Copy string before passing it to the sending method
|
||||
// because the original button can be destroyed inside.
|
||||
MsgId replyTo = (msg->id > 0) ? msg->id : 0;
|
||||
sendBotCommand(
|
||||
msg->history()->peer,
|
||||
msg->fromOriginal()->asUser(),
|
||||
QString(button->text),
|
||||
replyTo);
|
||||
if (sessionController) {
|
||||
MsgId replyTo = (msg->id > 0) ? msg->id : 0;
|
||||
sessionController->content()->sendBotCommand({
|
||||
.peer = msg->history()->peer,
|
||||
.command = QString(button->text),
|
||||
.context = msg->fullId(),
|
||||
.replyTo = replyTo,
|
||||
});
|
||||
}
|
||||
} break;
|
||||
|
||||
case ButtonType::Callback:
|
||||
|
@ -14,15 +14,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
class History;
|
||||
|
||||
namespace Data {
|
||||
struct FileOrigin;
|
||||
} // namespace Data
|
||||
|
||||
namespace InlineBots {
|
||||
namespace Layout {
|
||||
class ItemBase;
|
||||
} // namespace Layout
|
||||
} // namespace InlineBots
|
||||
namespace Window {
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
namespace App {
|
||||
|
||||
@ -37,13 +31,9 @@ template <typename Guard, typename Lambda>
|
||||
};
|
||||
}
|
||||
|
||||
void sendBotCommand(
|
||||
not_null<PeerData*> peer,
|
||||
UserData *bot,
|
||||
const QString &cmd,
|
||||
MsgId replyTo = 0);
|
||||
bool insertBotCommand(const QString &cmd);
|
||||
void activateBotCommand(
|
||||
Window::SessionController *sessionController,
|
||||
not_null<const HistoryItem*> msg,
|
||||
int row,
|
||||
int column);
|
||||
|
@ -447,9 +447,13 @@ auto ReplyMarkupClickHandler::getUrlButton() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ReplyMarkupClickHandler::onClickImpl() const {
|
||||
void ReplyMarkupClickHandler::onClick(ClickContext context) const {
|
||||
if (context.button != Qt::LeftButton) {
|
||||
return;
|
||||
}
|
||||
if (const auto item = _owner->message(_itemId)) {
|
||||
App::activateBotCommand(item, _row, _column);
|
||||
const auto my = context.other.value<ClickHandlerContext>();
|
||||
App::activateBotCommand(my.sessionWindow.get(), item, _row, _column);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class ReplyMarkupClickHandler : public LeftButtonClickHandler {
|
||||
class ReplyMarkupClickHandler : public ClickHandler {
|
||||
public:
|
||||
ReplyMarkupClickHandler(
|
||||
not_null<Data::Session*> owner,
|
||||
@ -278,8 +278,7 @@ public:
|
||||
_itemId = msgId;
|
||||
}
|
||||
|
||||
protected:
|
||||
void onClickImpl() const override;
|
||||
void onClick(ClickContext context) const override;
|
||||
|
||||
private:
|
||||
const not_null<Data::Session*> _owner;
|
||||
|
Loading…
Reference in New Issue
Block a user