summaryrefslogtreecommitdiff
path: root/samples/receive-file/src/main.cpp
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/receive-file/src/main.cpp
parent0910c166a920cdac931d40bcb63bfb28039005f1 (diff)
parent283cc4ba4670ed5546f007ec1a85b3fab40e6d6a (diff)
Merge pull request #300 from llnulldisk/master
Update to Bot API 7.2
Diffstat (limited to 'samples/receive-file/src/main.cpp')
-rw-r--r--samples/receive-file/src/main.cpp7
1 files changed, 4 insertions, 3 deletions
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);
});