diff options
author | Oleg Morozenkov <reo7sp@users.noreply.github.com> | 2017-01-02 22:56:12 +0300 |
---|---|---|
committer | Oleg Morozenkov <reo7sp@users.noreply.github.com> | 2017-01-02 22:56:12 +0300 |
commit | d410bff7b2e772c1dd1c6377ef0543ce16985159 (patch) | |
tree | 73e473cebd009e5cfdf0bee5d48b52ecb43a6340 | |
parent | d578d8be57e80d8ca05ad1bd936eb4936bd87d9d (diff) |
Fix new sample
-rw-r--r-- | samples/inline-keyboard/src/main.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/samples/inline-keyboard/src/main.cpp b/samples/inline-keyboard/src/main.cpp index 6832635..4e6fb21 100644 --- a/samples/inline-keyboard/src/main.cpp +++ b/samples/inline-keyboard/src/main.cpp @@ -18,25 +18,25 @@ int main() { Bot bot("PLACE YOUR TOKEN HERE"); // Thanks Pietro Falessi for code - TgBot::InlineKeyboardMarkup::Ptr Keyboard(new TgBot::InlineKeyboardMarkup); - std::vector<InlineKeyboardButton::Ptr> Row0; - TgBot::InlineKeyboardButton::Ptr CheckButton(new TgBot::InlineKeyboardButton); - CheckButton->text="Check"; - CheckButton->callbackData="Check"; - Row0.push_back(CheckButton); - Keyboard->inlineKeyboard.push_back(Row0); - - bot.getEvents().onCommand("start", [&bot, &Keyboard](Message::Ptr message) { - bot.getApi().sendMessage(message->chat->id, "Hi!",false,0, Keyboard); + InlineKeyboardMarkup::Ptr keyboard(new InlineKeyboardMarkup); + vector<InlineKeyboardButton::Ptr> row0; + InlineKeyboardButton::Ptr checkButton(new InlineKeyboardButton); + checkButton->text = "check"; + checkButton->callbackData = "check"; + row0.push_back(checkButton); + keyboard->inlineKeyboard.push_back(row0); + + bot.getEvents().onCommand("start", [&bot, &keyboard](Message::Ptr message) { + bot.getApi().sendMessage(message->chat->id, "Hi!", false, 0, keyboard); }); - bot.getEvents().onCommand("check", [&bot, &Keyboard](Message::Ptr message) { - string response = CheckCluster(); - bot.getApi().sendMessage(message->chat->id, response, false, 0, Keyboard,"Markdown"); + bot.getEvents().onCommand("check", [&bot, &keyboard](Message::Ptr message) { + string response = "ok"; + bot.getApi().sendMessage(message->chat->id, response, false, 0, keyboard, "Markdown"); }); - bot.getEvents().onCallbackQuery([&bot, &Keyboard](CallbackQuery::Ptr query) { - if (StringTools::startsWith(query->data, "Check")) { - string response = CheckCluster(); - bot.getApi().sendMessage(query->message->chat->id, response, false, 0, Keyboard,"Markdown"); + bot.getEvents().onCallbackQuery([&bot, &keyboard](CallbackQuery::Ptr query) { + if (StringTools::startsWith(query->data, "check")) { + string response = "ok"; + bot.getApi().sendMessage(query->message->chat->id, response, false, 0, keyboard, "Markdown"); } }); |