Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
3b517ce5
Commit
3b517ce5
authored
May 24, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples
parent
d6362448
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
33 deletions
+18
-33
README.md
README.md
+1
-22
getUpdatesCLI.php
examples/getUpdatesCLI.php
+9
-6
hook.php
examples/hook.php
+8
-5
No files found.
README.md
View file @
3b517ce5
...
...
@@ -43,7 +43,7 @@ A Telegram Bot based on the official [Telegram Bot API](https://core.telegram.or
-
[
Set Admins
](
#set-admins
)
-
[
Channel Administration
](
#channel-administration
)
-
[
Upload and Download directory path
](
#upload-and-download-directory-path
)
-
[
Logging
](
#logging
)
-
[
Logging
](
doc/01-utils.md
)
-
[
Documentation
](
#documentation
)
-
[
Projects with this library
](
#projects-with-this-library
)
-
[
Troubleshooting
](
#troubleshooting
)
...
...
@@ -511,27 +511,6 @@ $telegram->setDownloadPath('yourpath/Download');
$telegram->setUploadPath('yourpath/Upload');
```
### Logging
Thrown Exceptions are not stored by default. You can Enable this feature adding this line in your 'webhook.php' or 'getUpdates.php'
```
php
Longman
\T
elegramBot
\L
ogger::initialize('your_path/TelegramException.log');
```
Incoming update (json string from webhook and getUpdates) can be logged in a text file. Set those options with the methods:
```
php
$telegram->setLogRequests(true);
$telegram->setLogPath($BOT_NAME . '.log');
```
Set verbosity to 3 to also log curl requests and responses from the bot to Telegram:
```
php
$telegram->setLogRequests(true);
$telegram->setLogPath($BOT_NAME . '.log');
$telegram->setLogVerbosity(3);
```
## Documentation
Take a look at the repo [Wiki](https://github.com/akalongman/php-telegram-bot/wiki) for further information and tutorials!
...
...
examples/getUpdatesCLI.php
View file @
3b517ce5
...
...
@@ -4,8 +4,8 @@
//This configuration file is intented to run the bot with the webhook method
//Uncommented parameters must be filled
#
bash script
#
while true; do ./getUpdatesCLI.php; done
//
bash script
//
while true; do ./getUpdatesCLI.php; done
// Load composer
require
__DIR__
.
'/vendor/autoload.php'
;
...
...
@@ -42,9 +42,11 @@ try {
//$telegram->setCommandConfig('date', ['google_api_key' => 'your_google_api_key_here']);
//// Logging
//$telegram->setLogRequests(true);
//$telegram->setLogPath($BOT_NAME . '.log');
//$telegram->setLogVerbosity(3);
//$telegram->enableExternalLog($insert_ here_your_extenl_monolog_instance)
//$path = 'your_path'
//$telegram->setErrorLog($path . '/' . $BOT_NAME . '_error.log');
//$telegram->setDebugLog($path . '/' . $BOT_NAME . '_debug.log');
//$telegram->setUpdateLog($path . '/' . $BOT_NAME . '_update.log');
//// Set custom Upload and Download path
//$telegram->setDownloadPath('../Download');
...
...
@@ -64,6 +66,7 @@ try {
echo
$ServerResponse
->
printError
()
.
"
\n
"
;
}
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
// log telegram errors
echo
$e
;
// log telegram errors
\Longman\TelegramBot\TelegramLog
::
error
(
$e
);
}
examples/hook.php
View file @
3b517ce5
...
...
@@ -3,7 +3,7 @@
//This configuration file is intended to run the bot with the webhook method.
//Uncommented parameters must be filled
//Please notice that if you open this file with your browser you'll get the "Input is empty!" Exception.
//This is a normal behaviour because this address has to be reached only by Telegram server
//This is a normal behaviour because this address has to be reached only by Telegram server
.
// Load composer
require
__DIR__
.
'/vendor/autoload.php'
;
...
...
@@ -40,9 +40,11 @@ try {
//$telegram->setCommandConfig('date', ['google_api_key' => 'your_google_api_key_here']);
//// Logging
//$telegram->setLogRequests(true);
//$telegram->setLogPath($BOT_NAME . '.log');
//$telegram->setLogVerbosity(3);
//$telegram->enableExternalLog($insert_ here_your_extenl_monolog_instance)
//$path = 'your_path'
//$telegram->setErrorLog($path . '/' . $BOT_NAME . '_error.log');
//$telegram->setDebugLog($path . '/' . $BOT_NAME . '_debug.log');
//$telegram->setUpdateLog($path . '/' . $BOT_NAME . '_update.log');
//// Set custom Upload and Download path
//$telegram->setDownloadPath('../Download');
...
...
@@ -55,6 +57,7 @@ try {
$telegram
->
handle
();
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
// Silence is golden!
// log telegram errors
// echo $e;
// log telegram errors
\Longman\TelegramBot\TelegramLog
::
error
(
$e
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment