summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2024-06-11 00:42:07 +0300
committerGitHub <noreply@github.com>2024-06-11 00:42:07 +0300
commit986a7b5242182614c25404bfef75fb09a762a8c1 (patch)
treec18de405b668687683ce811fde777394821b6d06 /samples
parent0910c166a920cdac931d40bcb63bfb28039005f1 (diff)
parent283cc4ba4670ed5546f007ec1a85b3fab40e6d6a (diff)
Merge pull request #300 from llnulldisk/master
Update to Bot API 7.2
Diffstat (limited to 'samples')
-rw-r--r--samples/inline-keyboard/src/main.cpp6
-rw-r--r--samples/receive-file/src/main.cpp7
-rw-r--r--samples/reply-keyboard/src/main.cpp4
3 files changed, 9 insertions, 8 deletions
diff --git a/samples/inline-keyboard/src/main.cpp b/samples/inline-keyboard/src/main.cpp
index 2e3ec68..b84d363 100644
--- a/samples/inline-keyboard/src/main.cpp
+++ b/samples/inline-keyboard/src/main.cpp
@@ -25,16 +25,16 @@ int main() {
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.getApi().sendMessage(message->chat->id, "Hi!", nullptr, nullptr, keyboard);
});
bot.getEvents().onCommand("check", [&bot, &keyboard](Message::Ptr message) {
string response = "ok";
- bot.getApi().sendMessage(message->chat->id, response, false, 0, keyboard, "Markdown");
+ bot.getApi().sendMessage(message->chat->id, response, nullptr, nullptr, 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");
+ bot.getApi().sendMessage(query->message->chat->id, response, nullptr, nullptr, keyboard, "Markdown");
}
});
diff --git a/samples/receive-file/src/main.cpp b/samples/receive-file/src/main.cpp
index 7a0e8ff..5972534 100644
--- a/samples/receive-file/src/main.cpp
+++ b/samples/receive-file/src/main.cpp
@@ -20,12 +20,13 @@ int main() {
bot.getEvents().onAnyMessage([&bot](Message::Ptr message) {
printf("User wrote %s\n", message->text.c_str());
- File::Ptr file = bot.getApi().getFile(message->document->fileId);
- string fileContent = bot.getApi().downloadFile(file->filePath);
-
if (StringTools::startsWith(message->text, "/start")) {
return;
}
+
+ File::Ptr file = bot.getApi().getFile(message->document->fileId);
+ string fileContent = bot.getApi().downloadFile(file->filePath);
+
bot.getApi().sendMessage(message->chat->id, "Your file content: " + fileContent);
});
diff --git a/samples/reply-keyboard/src/main.cpp b/samples/reply-keyboard/src/main.cpp
index 9478368..877302b 100644
--- a/samples/reply-keyboard/src/main.cpp
+++ b/samples/reply-keyboard/src/main.cpp
@@ -54,10 +54,10 @@ int main() {
}, keyboardWithLayout);
bot.getEvents().onCommand("start", [&bot, &keyboardOneCol](Message::Ptr message) {
- bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", false, 0, keyboardOneCol);
+ bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", nullptr, nullptr, keyboardOneCol);
});
bot.getEvents().onCommand("layout", [&bot, &keyboardWithLayout](Message::Ptr message) {
- bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", false, 0, keyboardWithLayout);
+ bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", nullptr, nullptr, keyboardWithLayout);
});
bot.getEvents().onAnyMessage([&bot](Message::Ptr message) {
printf("User wrote %s\n", message->text.c_str());