Commit 6a14dd05 authored by LONGMAN's avatar LONGMAN

Fixed whoami command

parent 174ad22a
......@@ -6,6 +6,7 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Written by Marco Boretto <marco.bore@gmail.com>
*/
namespace Longman\TelegramBot\Commands;
......@@ -24,18 +25,17 @@ class CalcCommand extends Command
$chat_id = $message->getChat()->getId();
$message_id = $message->getMessageId();
$text = $message->getText(true);
#$elm = explode(" ",$text);
#array_shift($elm);
# $text = trim(implode(" ",$elm));
$text = preg_replace('/[^0-9\+\-\*\/\(\) ]/i', '',trim($text));
$text = preg_replace('/[^0-9\+\-\*\/\(\) ]/i', '', trim($text));
$compute = create_function('', 'return (' . trim($text) . ');' );
$data = array();
$data['chat_id'] = $chat_id;
$data['reply_to_message_id'] = $message_id;
$data['text'] = 0 + $compute();
......
......@@ -6,7 +6,8 @@
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* writteno by Marco Boretto <marco.bore@gmail.com>
*
* Written by Marco Boretto <marco.bore@gmail.com>
*/
namespace Longman\TelegramBot\Commands;
......@@ -25,13 +26,14 @@ class WhoamiCommand extends Command
$chat_id = $message->getChat()->getId();
$message_id = $message->getMessageId();
$text = $message->getText(true);
$from = $message->getFrom()->getFirstName().' '.$message->getFrom()->getLastName().' '.$message->getFrom()->getUsername();
$data = array();
$data['chat_id'] = $chat_id;
$data['text'] = 'Your name is: ' . $from;
$data['reply_to_message_id'] = $message_id;
$data['text'] = 'Your name is: ' . $message->getFrom()->getFirstName().' '.$message->getFrom()->getLastName();
$data['text'] = "\n".'Username: ' . $message->getFrom()->getUsername();
$result = Request::sendMessage($data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment