Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
809 stars 341 forks source link

Line break #123

Closed timh77 closed 6 years ago

timh77 commented 6 years ago

Hi,

Have tried almost every option I could think of to get a linebreak in the sendMessage function working. But nothing worked. Would you have any idea?

\n \n (escaped) %0A even linefeeds in the message string itself

Eleirbag89 commented 6 years ago

In the CowBot just \n does the trick:

$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Welcome to CowBot \xF0\x9F\x90\xAE \nPlease type /cowsay or click the Cow button !");
    $telegram->sendMessage($content);
Mohsen322 commented 6 years ago

U can simply used PHP_EOL. Predefined constant

Example: $text='hello world'.PHP_EOL.'next line';

pablosouza10 commented 6 years ago

Try: some text line one . "\n" . Some text line two... PS: double quotes.

Em 14 de jan de 2018 06:42, "Mohsen322" notifications@github.com escreveu:

U can simply used PHP_EOL. Predefined constant

Example: $text='hello world'.PHP_EOL.'next line';

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Eleirbag89/TelegramBotPHP/issues/123#issuecomment-357499644, or mute the thread https://github.com/notifications/unsubscribe-auth/ARCFox1Ajapf7Zqz9Wgpb_w34APdghK7ks5tKcwhgaJpZM4RdXjl .

timh77 commented 6 years ago

Thanks all! Not sure what happend, tried the exact same code today again and it worked fine. Reminds me not to work during weekend ;-)