Added example get_updates.php
This commit is contained in:
parent
26251f29f1
commit
f311c59ade
1 changed files with 17 additions and 0 deletions
17
tests/get_updates.php
Normal file
17
tests/get_updates.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require 'ncc';
|
||||||
|
import('net.nosial.tgbotlib');
|
||||||
|
|
||||||
|
$bot = new TgBotLib\Bot('5126030313:AAEn3QcwSvTJ2eAKUnSb_MkC5U0tlqkM1xw');
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
foreach($bot->getUpdates() as $update)
|
||||||
|
{
|
||||||
|
if($update->getMessage() !== null && $update->getMessage()->getText() !== null)
|
||||||
|
{
|
||||||
|
print(sprintf("%s: %s", $update->getMessage()->getFrom()->getFirstName(), $update->getMessage()->getText()) . PHP_EOL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue