tgbot-cpp
tgbot-cpp copied to clipboard
build: windows
from @enhanceyourlifeimmediately:
Building for Windows:
0. If you're doing Windows dev and not using vcpkg, start using it! : cpp
https://www.reddit.com/r/cpp/comments/5ud9sr/if_youre_doing_windows_dev_and_not_using_vcpkg/
1. Vcpkg tutorial - Install C and C++ libraries
https://www.youtube.com/watch?v=wRnjahwxZ8A
1. vcpkg: Microsoft Docs
https://docs.microsoft.com/de-de/cpp/build/vcpkg?view=vs-2017
2. after library is set up; execute with CMake; install built .sln
https://www.youtube.com/watch?v=LxHV-KNEG3k
2. Setting a cross-compiler file using the CMake GUI
https://stackoverflow.com/questions/29982505/setting-a-cross-compiler-file-using-the-cmake-gui
2. setting up CMake after libraries installed (toolchain file)
https://www.reddit.com/r/cpp_questions/comments/ajs9xi/problem_with_cmake_when_building/
Very common problems:
1. perhaps check whether bot is admin --> kickChatMember() would crash otherwise
2. message->chat->title only available in group --> else crash
3. deleteMessage() --> try-catch
4. sendMessage() --> try-catch
5. kickChatMember() --> try-catch
6. bot cannot start a conversation --> all users in "InitiatedChat.dat" can be contacted
8. before automatic functions it needs to be checked whether the message contains text --> join messages do not! --> it would crash
9. use <b></b> (bold) to mark variables in texts --> (..., false, 0, std::make_shared<TgBot::GenericReply>(), "HTML"); #####CHECKED#####
10. message can only be deleted in a group
11. try-catch around creation of a ReplyKeyboardMarkup
--> requestContact or requestLocation of buttons only available in private chat (else crash)