Skip to content

Commit

Permalink
Checked all examples and fixed where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
unreal4u committed Nov 3, 2016
1 parent 410398a commit ef9ba70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 11 additions & 4 deletions examples/get-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@

$getUpdates = new GetUpdates();
#$getUpdates->offset = 328221148;
$updates = $tgLog->performApiRequest($getUpdates);

echo '<pre>';
foreach ($updates->traverseObject() as $update) {
var_dump($update);
#var_dump(sprintf('Chat id is #%d', $update->message->chat->id));
try {
$updates = $tgLog->performApiRequest($getUpdates);
foreach ($updates->traverseObject() as $update) {
var_dump($update);
#var_dump(sprintf('Chat id is #%d', $update->message->chat->id));
}
} catch (\Exception $e) {
$actualProblem = json_decode((string)$e->getResponse()->getBody());
print_r('[EXCEPTION] '.$actualProblem->description.'; original response:');
print_r($actualProblem);
}

echo '</pre>';
4 changes: 3 additions & 1 deletion examples/send-message-and-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

include('basics.php');

use GuzzleHttp\Exception\ClientException;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use unreal4u\TelegramAPI\Telegram\Methods\EditMessageText;
Expand All @@ -13,10 +14,11 @@

$tgLog = new TgLog(BOT_TOKEN, $logger);
$sendMessage = new SendMessage();
$sendMessage->chat_id = A_GROUP_CHAT_ID;
$sendMessage->chat_id = A_USER_CHAT_ID;
$sendMessage->text = 'Hello world, this is a test';
$message = $tgLog->performApiRequest($sendMessage);

sleep(3);
$editMessageText = new EditMessageText();
$editMessageText->message_id = $message->message_id;
#$editMessageText->message_id = 1112222;
Expand Down

0 comments on commit ef9ba70

Please sign in to comment.