#pragma once #include "curl/multi.h" #include "uv.h" #include #include #include namespace detail { template struct overload; template struct overload : public F { explicit overload(F f) : F(f) { } }; template struct overload : public overload , public overload { overload(F f, Fs... fs) : overload(f), overload(fs...) { } using overload::operator(); using overload::operator(); }; } // namespace detail template auto overloaded(F... f) { return detail::overload(f...); } enum class CommandLineParamError { NoApiCreds }; struct ApiCreds { int id; std::string hash; std::string botToken; }; struct CommandLineParams { ApiCreds apiCreds; std::string botToken; }; struct TelegramClient; struct active_request { std::vector receivedData; std::function doneCallback; active_request(std::function doneCallback): doneCallback(doneCallback) {} }; struct context { TelegramClient *tg; ApiCreds apiCreds; CURLM *curl; uv_timer_t curlTimer; std::map requests; }; size_t curl_receive_cb(char *ptr, size_t size, size_t nmemb, CURL *ctx);