Core: how to getMessage without command

Created on 30 Sep 2017  路  6Comments  路  Source: php-telegram-bot/core

hi
i want to get message without command , but i can't

Most helpful comment

what loop?

$update = json_decode(file_get_contents('php://input'), true);
$message = $update['message']
$text = $message['text'];

// now, preg_match or some wise parse $text
// to detect and remove "/command" from "/command something"

All 6 comments

Inside a command object:

$text = $this->getMessage()->getText(true);

without command !
just in hook.php

$bot = new Longman\TelegramBot\Telegram('token', 'username');

$update = json_decode(Longman\TelegramBot\Request::getInput(), true);
$message = $update['message'];

Something like this?

Thank you ...
but it's in the loop
I do not want to be in the loop

what loop?

$update = json_decode(file_get_contents('php://input'), true);
$message = $update['message']
$text = $message['text'];

// now, preg_match or some wise parse $text
// to detect and remove "/command" from "/command something"

Thank you for your help ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

esomkin picture esomkin  路  3Comments

ttvd94 picture ttvd94  路  4Comments

abbe-cipher picture abbe-cipher  路  4Comments

smaznet picture smaznet  路  4Comments

vansanblch picture vansanblch  路  3Comments