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
0f4189ac
Unverified
Commit
0f4189ac
authored
Jul 30, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update readme and examples for enableAdmin(s) and add an extra test for string numbers.
parent
d97f3862
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
README.md
README.md
+5
-1
getUpdatesCLI.php
examples/getUpdatesCLI.php
+4
-2
hook.php
examples/hook.php
+4
-2
TelegramTest.php
tests/Unit/TelegramTest.php
+8
-0
No files found.
README.md
View file @
0f4189ac
...
...
@@ -487,7 +487,11 @@ Enabling this feature, the admin bot can perform some super user commands like:
You can specify one or more admins with this option:
```
php
$telegram->enableAdmins(
[
'your_telegram_user_id', 'other_telegram_user_id'
]
);
//Single admin
$telegram->enableAdmin(your_telegram_user_id);
//Multiple admins
$telegram->enableAdmins(
[
your_telegram_user_id, other_telegram_user_id
]
);
```
Telegram user id can be retrieved with the command **/whoami**.
Admin commands are stored in *src/Admin/* folder.
...
...
examples/getUpdatesCLI.php
View file @
0f4189ac
...
...
@@ -33,8 +33,10 @@ try {
//// Add an additional commands path
//$telegram->addCommandsPath($commands_path);
//// Here you can enable admin interface for the channel you want to manage
//$telegram->enableAdmins(['your_telegram_id']);
//// Enable admin users
//$telegram->enableAdmin(your_telegram_id);
//// Add the channel you want to manage
//$telegram->setCommandConfig('sendtochannel', ['your_channel' => '@type_here_your_channel']);
//// Here you can set some command specific parameters,
...
...
examples/hook.php
View file @
0f4189ac
...
...
@@ -31,8 +31,10 @@ try {
//// Add an additional commands path
//$telegram->addCommandsPath($commands_path);
//// Here you can enable admin interface for the channel you want to manage
//$telegram->enableAdmins(['your_telegram_id']);
//// Enable admin users
//$telegram->enableAdmin(your_telegram_id);
//// Add the channel you want to manage
//$telegram->setCommandConfig('sendtochannel', ['your_channel' => '@type_here_your_channel']);
//// Here you can set some command specific parameters,
...
...
tests/Unit/TelegramTest.php
View file @
0f4189ac
...
...
@@ -91,15 +91,23 @@ class TelegramTest extends TestCase
$this
->
assertEmpty
(
$tg
->
getAdminList
());
// Single
$tg
->
enableAdmin
(
1
);
$this
->
assertCount
(
1
,
$tg
->
getAdminList
());
// Multiple
$tg
->
enableAdmins
([
2
,
3
]);
$this
->
assertCount
(
3
,
$tg
->
getAdminList
());
// Already added
$tg
->
enableAdmin
(
2
);
$this
->
assertCount
(
3
,
$tg
->
getAdminList
());
// Integer as a string
$tg
->
enableAdmin
(
'4'
);
$this
->
assertCount
(
3
,
$tg
->
getAdminList
());
// Random string
$tg
->
enableAdmin
(
'a string?'
);
$this
->
assertCount
(
3
,
$tg
->
getAdminList
());
}
...
...
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