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
83436f83
Commit
83436f83
authored
Jul 19, 2017
by
Armando Lüscher
Committed by
GitHub
Jul 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #565 from jacklul/cron_patch
Scheduler patch
parents
fae82d96
d806cde5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
CHANGELOG.md
CHANGELOG.md
+2
-0
Telegram.php
src/Telegram.php
+14
-9
No files found.
CHANGELOG.md
View file @
83436f83
...
@@ -9,6 +9,8 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
...
@@ -9,6 +9,8 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Deprecated
### Deprecated
### Removed
### Removed
### Fixed
### Fixed
-
`Telegram::enableAdmin()`
now handles duplicate additions properly.
-
`Request::getMe()`
failure doesn't break cron execution any more.
### Security
### Security
## [0.46.0] - 2017-07-15
## [0.46.0] - 2017-07-15
...
...
src/Telegram.php
View file @
83436f83
...
@@ -520,10 +520,10 @@ class Telegram
...
@@ -520,10 +520,10 @@ class Telegram
*/
*/
public
function
enableAdmin
(
$admin_id
)
public
function
enableAdmin
(
$admin_id
)
{
{
if
(
is_int
(
$admin_id
)
&&
$admin_id
>
0
&&
!
in_array
(
$admin_id
,
$this
->
admins_list
,
true
))
{
if
(
!
is_int
(
$admin_id
)
||
$admin_id
<=
0
)
{
$this
->
admins_list
[]
=
$admin_id
;
}
else
{
TelegramLog
::
error
(
'Invalid value "%s" for admin.'
,
$admin_id
);
TelegramLog
::
error
(
'Invalid value "%s" for admin.'
,
$admin_id
);
}
elseif
(
!
in_array
(
$admin_id
,
$this
->
admins_list
,
true
))
{
$this
->
admins_list
[]
=
$admin_id
;
}
}
return
$this
;
return
$this
;
...
@@ -904,15 +904,20 @@ class Telegram
...
@@ -904,15 +904,20 @@ class Telegram
$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!
$this
->
botan_enabled
=
false
;
// Force disable Botan.io integration, we don't want to track self-executed commands!
$result
=
Request
::
getMe
()
->
getResult
()
;
$result
=
Request
::
getMe
();
if
(
!
$result
->
getId
())
{
if
(
$result
->
isOk
())
{
throw
new
TelegramException
(
'Received empty/invalid getMe result!'
);
$result
=
$result
->
getResult
();
}
$bot_id
=
$result
->
getId
();
$bot_id
=
$result
->
getId
();
$bot_name
=
$result
->
getFirstName
();
$bot_name
=
$result
->
getFirstName
();
$bot_username
=
$result
->
getUsername
();
$bot_username
=
$result
->
getUsername
();
}
else
{
$bot_id
=
$this
->
getBotId
();
$bot_name
=
$this
->
getBotUsername
();
$bot_username
=
$this
->
getBotUsername
();
}
$this
->
enableAdmin
(
$bot_id
);
// Give bot access to admin commands
$this
->
enableAdmin
(
$bot_id
);
// Give bot access to admin commands
$this
->
getCommandsList
();
// Load full commands list
$this
->
getCommandsList
();
// Load full commands list
...
...
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