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
27b7a8c0
Unverified
Commit
27b7a8c0
authored
Jun 05, 2017
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add custom_input for getUpdates method.
parent
41cfa0b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
CHANGELOG.md
CHANGELOG.md
+1
-0
Telegram.php
src/Telegram.php
+21
-16
No files found.
CHANGELOG.md
View file @
27b7a8c0
...
...
@@ -10,6 +10,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Deprecated
### Removed
### Fixed
-
Take
`custom_input`
into account when using getUpdates method (mainly for testing).
### Security
## [0.44.1] - 2017-04-25
...
...
src/Telegram.php
View file @
27b7a8c0
...
...
@@ -334,20 +334,25 @@ class Telegram
);
}
//DB Query
$last_update
=
DB
::
selectTelegramUpdate
(
1
);
$last_update
=
reset
(
$last_update
);
//Take custom input into account.
if
(
$custom_input
=
$this
->
getCustomInput
())
{
$response
=
new
ServerResponse
(
json_decode
(
$custom_input
,
true
),
$this
->
bot_username
);
}
else
{
//DB Query
$last_update
=
DB
::
selectTelegramUpdate
(
1
);
$last_update
=
reset
(
$last_update
);
//As explained in the telegram bot api documentation
$offset
=
isset
(
$last_update
[
'id'
])
?
$last_update
[
'id'
]
+
1
:
null
;
//As explained in the telegram bot api documentation
$offset
=
isset
(
$last_update
[
'id'
])
?
$last_update
[
'id'
]
+
1
:
null
;
$response
=
Request
::
getUpdates
(
[
'offset'
=>
$offset
,
'limit'
=>
$limit
,
'timeout'
=>
$timeout
,
]
);
$response
=
Request
::
getUpdates
(
[
'offset'
=>
$offset
,
'limit'
=>
$limit
,
'timeout'
=>
$timeout
,
]
);
}
if
(
$response
->
isOk
())
{
//Process all updates
...
...
@@ -890,7 +895,7 @@ class Telegram
/**
* Enable requests limiter
*
* @param array
$options
* @param array $options
*
* @return \Longman\TelegramBot\Telegram
*/
...
...
@@ -914,7 +919,7 @@ class Telegram
throw
new
TelegramException
(
'No command(s) provided!'
);
}
$this
->
run_commands
=
true
;
$this
->
run_commands
=
true
;
$this
->
botan_enabled
=
false
;
// Force disable Botan.io integration, we don't want to track self-executed commands!
$result
=
Request
::
getMe
()
->
getResult
();
...
...
@@ -943,8 +948,8 @@ class Telegram
],
'date'
=>
time
(),
'chat'
=>
[
'id'
=>
$bot_id
,
'type'
=>
'private'
,
'id'
=>
$bot_id
,
'type'
=>
'private'
,
],
'text'
=>
$command
,
],
...
...
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