mardi 4 septembre 2018

c++ telegram bot. new line in sendMessage using cURL library

I didn't find something helping me in the web so i'll ask you for help.

I try sending a Message with several line breaks.

e.g.:

Hey! Welcome to the channel!

So my code:

int main(){

   CURL *handle
   handle = curl_easy_init();

   string url = "https://api.telegram.org/<bottoken>/sendMessage?chat_id-idnbr&text=Hey\nwhatsup"

   curl_easy_setopt(handle , CURLOPT_URL, url.c_str());

   curl_easy_perform(handle);
}

Now if i set it like this i get the CURLcode 3 CURL_URL_MALFORMAT (URL not formatted right)

Any idea what to do?

Aucun commentaire:

Enregistrer un commentaire