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
7c338752
Commit
7c338752
authored
Dec 19, 2015
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output moved outside lib
parent
d7c61bee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
getUpdatesCLI.php
examples/getUpdatesCLI.php
+11
-1
Telegram.php
src/Telegram.php
+5
-7
No files found.
examples/getUpdatesCLI.php
View file @
7c338752
...
@@ -36,7 +36,17 @@ try {
...
@@ -36,7 +36,17 @@ try {
//$telegram->setUploadPath("../Upload");
//$telegram->setUploadPath("../Upload");
// handle telegram getUpdate request
// handle telegram getUpdate request
$telegram
->
handleGetUpdates
();
$ServerResponse
=
$telegram
->
handleGetUpdates
();
if
(
$ServerResponse
->
isOk
())
{
$n_update
=
count
(
$ServerResponse
->
getResult
());
print
(
date
(
'Y-m-d H:i:s'
,
time
())
.
' - Processed '
.
$n_update
.
" updates
\n
"
);
}
else
{
print
(
date
(
'Y-m-d H:i:s'
,
time
())
.
" - Fail fetch updates
\n
"
);
echo
$ServerResponse
->
printError
()
.
"
\n
"
;
}
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
// log telegram errors
// log telegram errors
echo
$e
;
echo
$e
;
...
...
src/Telegram.php
View file @
7c338752
...
@@ -29,7 +29,7 @@ class Telegram
...
@@ -29,7 +29,7 @@ class Telegram
*
*
* @var string
* @var string
*/
*/
protected
$version
=
'0.2
3
.0'
;
protected
$version
=
'0.2
4
.0'
;
/**
/**
* Telegram API key
* Telegram API key
...
@@ -334,7 +334,7 @@ class Telegram
...
@@ -334,7 +334,7 @@ class Telegram
/**
/**
* Handle getUpdates method
* Handle getUpdates method
*
*
*
@return \Longman\TelegramBot\Telegram
*
*/
*/
public
function
handleGetUpdates
(
$limit
=
null
,
$timeout
=
null
)
public
function
handleGetUpdates
(
$limit
=
null
,
$timeout
=
null
)
...
@@ -354,19 +354,17 @@ class Telegram
...
@@ -354,19 +354,17 @@ class Telegram
'limit'
=>
$limit
,
'limit'
=>
$limit
,
'timeout'
=>
$timeout
'timeout'
=>
$timeout
]);
]);
if
(
$ServerResponse
->
isOk
())
{
if
(
$ServerResponse
->
isOk
())
{
$results
=
''
;
$results
=
''
;
$n_update
=
count
(
$ServerResponse
->
getResult
());
$n_update
=
count
(
$ServerResponse
->
getResult
());
for
(
$a
=
0
;
$a
<
$n_update
;
$a
++
)
{
for
(
$a
=
0
;
$a
<
$n_update
;
$a
++
)
{
$result
=
$this
->
processUpdate
(
$ServerResponse
->
getResult
()[
$a
]);
$result
=
$this
->
processUpdate
(
$ServerResponse
->
getResult
()[
$a
]);
}
}
print
(
date
(
'Y-m-d H:i:s'
,
time
())
.
' - Processed '
.
$a
.
" updates
\n
"
);
}
else
{
print
(
date
(
'Y-m-d H:i:s'
,
time
())
.
" - Fail fetch updates
\n
"
);
echo
$ServerResponse
->
printError
()
.
"
\n
"
;
}
}
//return $results
return
$ServerResponse
;
}
}
/**
/**
...
...
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