reo7sp / tgbot-cpp

C++ library for Telegram bot API
http://reo7sp.github.io/tgbot-cpp
MIT License
995 stars 238 forks source link

how to specify message type #259

Closed miannoodle01 closed 1 year ago

miannoodle01 commented 1 year ago

Hello! I just want to know how can we know if a user send a video or image or text? how to do that? thanks!

MrVolot commented 1 year ago

TgBot::Message::Ptr message has all of the things that you mentioned (video, photo, voice, etc). Tou can access it by message->photo, for example. If you want to check what is present, you can check what is empty.

miannoodle01 commented 1 year ago

@MrVolot Thanks! I want to to make a bot to download files that user sends to it and save them to memory, do you know how to do this? or is there any example codes for this?

MrVolot commented 1 year ago

You can check it here: https://stackoverflow.com/a/32679930. The API calls that are mentioned there are implemented as methods in this library.