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
499c74c9
Commit
499c74c9
authored
Aug 02, 2017
by
Armando Lüscher
Committed by
GitHub
Aug 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into cleanup_nodb
parents
6bfbcd7b
69ed1e89
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
172 additions
and
121 deletions
+172
-121
CHANGELOG.md
CHANGELOG.md
+3
-0
README.md
README.md
+154
-111
Telegram.php
src/Telegram.php
+15
-10
No files found.
CHANGELOG.md
View file @
499c74c9
...
...
@@ -6,9 +6,12 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
## [Unreleased]
### Added
### Changed
-
Updated readme to latest state of 0.46.0.
### Deprecated
### Removed
### Fixed
-
`Telegram::enableAdmin()`
now handles duplicate additions properly.
-
`Request::getMe()`
failure doesn't break cron execution any more.
### Security
## [0.46.0] - 2017-07-15
...
...
README.md
View file @
499c74c9
This diff is collapsed.
Click to expand it.
src/Telegram.php
View file @
499c74c9
...
...
@@ -440,7 +440,7 @@ class Telegram
'left_chat_member'
,
'migrate_from_chat_id'
,
'migrate_to_chat_id'
,
'new_chat_member'
,
'new_chat_member
s
'
,
'new_chat_photo'
,
'new_chat_title'
,
'pinned_message'
,
...
...
@@ -520,10 +520,10 @@ class Telegram
*/
public
function
enableAdmin
(
$admin_id
)
{
if
(
is_int
(
$admin_id
)
&&
$admin_id
>
0
&&
!
in_array
(
$admin_id
,
$this
->
admins_list
,
true
))
{
$this
->
admins_list
[]
=
$admin_id
;
}
else
{
if
(
!
is_int
(
$admin_id
)
||
$admin_id
<=
0
)
{
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
;
...
...
@@ -904,15 +904,20 @@ class Telegram
$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
()
;
$result
=
Request
::
getMe
();
if
(
!
$result
->
getId
())
{
throw
new
TelegramException
(
'Received empty/invalid getMe result!'
);
if
(
$result
->
isOk
())
{
$result
=
$result
->
getResult
();
$bot_id
=
$result
->
getId
();
$bot_name
=
$result
->
getFirstName
();
$bot_username
=
$result
->
getUsername
();
}
else
{
$bot_id
=
$this
->
getBotId
();
$bot_name
=
$this
->
getBotUsername
();
$bot_username
=
$this
->
getBotUsername
();
}
$bot_id
=
$result
->
getId
();
$bot_name
=
$result
->
getFirstName
();
$bot_username
=
$result
->
getUsername
();
$this
->
enableAdmin
(
$bot_id
);
// Give bot access to admin commands
$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