Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F620951
example-getUpdatesCLI.php
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
example-getUpdatesCLI.php
View Options
#!/usr/bin/env php
<?php
#bash script
#while true; do ./getUpdatesCLI.php; done
//Composer Loader
$loader
=
require
__DIR__
.
'/vendor/autoload.php'
;
$API_KEY
=
'your_bot_api_key'
;
$BOT_NAME
=
'namebot'
;
//$COMMANDS_FOLDER = __DIR__.'/Commands/';
$credentials
=
array
(
'host'
=>
'localhost'
,
'user'
=>
'dbuser'
,
'password'
=>
'dbpass'
,
'database'
=>
'dbname'
)
;
try
{
// create Telegram API object
$telegram
=
new
Longman
\
TelegramBot
\
Telegram
(
$API_KEY
,
$BOT_NAME
)
;
//Options
$telegram
->
enableMySQL
(
$credentials
)
;
//$telegram->enableMySQL($credentials, $BOT_NAME.'_');
//$telegram->addCommandsPath($COMMANDS_FOLDER);
//here you can set some command specified parameters,
//for example, google geocode/timezone api key for date command:
//$telegram->setCommandConfig('date', array('google_api_key'=>'your_google_api_key_here'));
//$telegram->setLogRequests(true);
//$telegram->setLogPath($BOT_NAME.'.log');
// handle telegram getUpdate request
$telegram
->
handleGetUpdates
(
)
;
}
catch
(
Longman
\
TelegramBot
\
Exception
\
TelegramException
$e
)
{
// log telegram errors
echo
$e
->
getMessage
(
)
;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 6:37 PM (17 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
138645
Default Alt Text
example-getUpdatesCLI.php (1 KB)
Attached To
Mode
R123 php-telegram-bot
Attached
Detach File
Event Timeline