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
a6d527f2
Commit
a6d527f2
authored
Feb 11, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small typo fixes and other corrections.
parent
1954213e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
README.md
README.md
+22
-18
No files found.
README.md
View file @
a6d527f2
...
...
@@ -93,7 +93,7 @@ above, but start it with `@`)
Current status is: ENABLED
```
12.
Type
`Disable`
to let your bot receive all messages sent to a
12.
Type
(or select)
`Disable`
to let your bot receive all messages sent to a
group. This step is up to you actually.
13.
@botfather replies with
`Success! The new status is: DISABLED. /help`
...
...
@@ -141,7 +141,7 @@ The bot can handle updates with **webhook** or **getUpdate** method:
In order to set a
[
Webhook
](
https://core.telegram.org/bots/api#setwebhook
)
you need a server with https and composer support.
(For a
[
self signed certificate
](
#self-signed-certificate
)
you need to add some extra code)
Create
*set.php*
(just copy and edit
*examples/set.php*
) and put into it:
Create
*set.php*
(
or
just copy and edit
*examples/set.php*
) and put into it:
```
php
<?php
// Load composer
...
...
@@ -194,6 +194,10 @@ To upload the certificate, add the certificate path as a parameter in *set.php*:
$result
=
$telegram
->
setWebHook
(
$hook_url
,
$certificate_path
);
```
### Unset Webhook
Edit
*example/unset.php*
with your bot credentials and execute it.
## getUpdate installation
The MySQL database must be active!
...
...
@@ -237,7 +241,9 @@ then run
./getUpdateCLI.php
```
## Types
## Support
### Types
All types are implemented according to Telegram API (20 January 2016).
...
...
@@ -266,7 +272,7 @@ $data = ['chat_id' => $chat_id];
$result
=
Request
::
sendPhoto
(
$data
,
$telegram
->
getUploadPath
()
.
'/image.jpg'
);
```
If you know the
file_id
of a previously uploaded file, just include it in the data array:
If you know the
`file_id`
of a previously uploaded file, just include it in the data array:
```
php
$data
=
[
...
...
@@ -277,7 +283,7 @@ $result = Request::sendPhoto($data);
```
*sendAudio*
,
*sendDocument*
,
*sendSticker*
,
*sendVideo*
and
*sendVoice*
all work in the same way.
See
*ImageCommand.php*
for a full example.
See
*
examples/Commands/
ImageCommand.php*
for a full example.
#### Send Chat Action
...
...
@@ -287,11 +293,11 @@ Request::sendChatAction(['chat_id' => $chat_id, 'action' => 'typing']);
#### getUserProfilePhoto
Retrieve the user photo, see
*WhoamiCommand.php*
for a full example.
Retrieve the user photo, see
*
src/Commands/
WhoamiCommand.php*
for a full example.
#### getFile and dowloadFile
Get the file path and download it, see
*WhoamiCommand.php*
for a full example.
Get the file path and download it, see
*
src/Commands/
WhoamiCommand.php*
for a full example.
#### Send message to all active chats
...
...
@@ -306,11 +312,11 @@ $results = Request::sendToActiveChats(
true
,
// Send to chats (super group chat)
true
,
// Send to users (single chat)
null
,
// 'yyyy-mm-dd hh:mm:ss' date range from
null
// 'yyyy-mm-dd hh:mm:ss' date range to
null
,
// 'yyyy-mm-dd hh:mm:ss' date range to
);
```
You can also broadcast a message to users, from the private chat with your bot. Take a look at the
admin interface
below.
You can also broadcast a message to users, from the private chat with your bot. Take a look at the
[
admin commands
](
#admin-commands
)
below.
## Utils
...
...
@@ -342,7 +348,7 @@ You can also store inline query and chosen inline query in the database.
### Channels Support
All methods implemented can be used to manage channels.
With
admin interface
you can manage your channel directly with your bot private chat.
With
[
admin commands
](
#admin-commands
)
you can manage your channel directly with your bot private chat.
### Commands
...
...
@@ -361,7 +367,9 @@ It can execute command triggering a chat event. Here's the list:
**GenericCommand.php**
lets you handle commands that don't exist or to
use commands as a variable:
Favourite colour?
**/black, /red**
Favourite number?
**/1, /134**
**GenericmessageCommand.php**
lets you handle any type of message.
...
...
@@ -386,7 +394,7 @@ $telegram->setCommandConfig('date', ['google_api_key' => 'your_google_api_key_he
### Admin Commands
Enabling this feature, the admin bot can perform some super user command like:
Enabling this feature, the admin bot can perform some super user command
s
like:
-
Send message to all chats
*/sendtoall*
-
List all the chats started with the bot
*/chats*
-
Send a message to a channel
*/sendtochannel*
(NEW! see below how to configure it)
...
...
@@ -401,12 +409,12 @@ To get a list of all available commands, type **/help**.
#### Channel Administration
To enable this feature follow th
o
se steps:
To enable this feature follow th
e
se steps:
-
Add your bot as channel administrator, this can be done with any telegram client.
-
Enable admin interface for your user as explained in the admin section above.
-
Enter your channel name as a param
for the sendtoall
command:
-
Enter your channel name as a param
eter for the
*/sendtochannel*
command:
```
php
$telegram
->
setCommandConfig
(
'sendtochannel'
,
[
'your_channel'
=>
'@type_here_your_channel'
]);
$telegram
->
setCommandConfig
(
'sendtochannel'
,
[
'your_channel'
=>
'@type_here_your_channel'
]);
```
-
Enjoy!
...
...
@@ -418,10 +426,6 @@ $telegram->setDownloadPath('yourpath/Download');
$telegram
->
setUploadPath
(
'yourpath/Upload'
);
```
### Unset Webhook
Edit
*example/unset.php*
with your bot credentials and execute it.
### Logging
Thrown Exceptions are stored in
*TelegramException.log*
file (in the base directory).
...
...
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