2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Refactored sending bot commands.

This commit is contained in:
23rd
2021-07-27 02:18:11 +03:00
parent 34cac3092f
commit a030907598
16 changed files with 149 additions and 52 deletions

View File

@@ -572,12 +572,19 @@ void ActionsFiller::addBotCommandActions(not_null<UserData*> user) {
return !findBotCommand(command).isEmpty();
});
};
auto sendBotCommand = [=](const QString &command) {
auto original = findBotCommand(command);
if (!original.isEmpty()) {
Ui::showPeerHistory(user, ShowAtTheEndMsgId);
App::sendBotCommand(user, user, '/' + original);
auto sendBotCommand = [=, window = _controller->parentController()](
const QString &command) {
const auto original = findBotCommand(command);
if (original.isEmpty()) {
return;
}
BotCommandClickHandler('/' + original).onClick(ClickContext{
Qt::LeftButton,
QVariant::fromValue(ClickHandlerContext{
.sessionWindow = base::make_weak(window.get()),
.peer = user,
})
});
};
auto addBotCommand = [=](
rpl::producer<QString> text,