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
235fd820
Commit
235fd820
authored
Aug 31, 2015
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Readme update
parent
c1b0996c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
8 deletions
+2
-8
README.md
README.md
+2
-8
No files found.
README.md
View file @
235fd820
...
@@ -100,7 +100,6 @@ You must set [WebHook](https://core.telegram.org/bots/api#setwebhook)
...
@@ -100,7 +100,6 @@ You must set [WebHook](https://core.telegram.org/bots/api#setwebhook)
Create set.php and put:
Create set.php and put:
```
php
```
php
<?php
<?php
$loader
=
require
__DIR__
.
'/vendor/autoload.php'
;
$loader
=
require
__DIR__
.
'/vendor/autoload.php'
;
$API_KEY
=
'your_bot_api_key'
;
$API_KEY
=
'your_bot_api_key'
;
...
@@ -109,7 +108,6 @@ $BOT_NAME = 'namebot';
...
@@ -109,7 +108,6 @@ $BOT_NAME = 'namebot';
try
{
try
{
// create Telegram API object
// create Telegram API object
$telegram
=
new
Longman\TelegramBot\Telegram
(
$API_KEY
,
$BOT_NAME
);
$telegram
=
new
Longman\TelegramBot\Telegram
(
$API_KEY
,
$BOT_NAME
);
// set webhook
// set webhook
echo
$telegram
->
setWebHook
(
'https://yourdomain/yourpath_to_hook.php'
);
echo
$telegram
->
setWebHook
(
'https://yourdomain/yourpath_to_hook.php'
);
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
}
catch
(
Longman\TelegramBot\Exception\TelegramException
$e
)
{
...
@@ -122,7 +120,6 @@ And open your set.php via browser
...
@@ -122,7 +120,6 @@ And open your set.php via browser
After create hook.php and put:
After create hook.php and put:
```
php
```
php
<?php
<?php
$loader
=
require
__DIR__
.
'/vendor/autoload.php'
;
$loader
=
require
__DIR__
.
'/vendor/autoload.php'
;
$API_KEY
=
'your_bot_api_key'
;
$API_KEY
=
'your_bot_api_key'
;
...
@@ -131,7 +128,6 @@ $BOT_NAME = 'namebot';
...
@@ -131,7 +128,6 @@ $BOT_NAME = 'namebot';
try
{
try
{
// create Telegram API object
// create Telegram API object
$telegram
=
new
Longman\TelegramBot\Telegram
(
$API_KEY
,
$BOT_NAME
);
$telegram
=
new
Longman\TelegramBot\Telegram
(
$API_KEY
,
$BOT_NAME
);
// here you can set some command specified parameters, for example, google geocode/timezone api key for date command:
// here you can set some command specified parameters, for example, google geocode/timezone api key for date command:
$telegram
->
setCommandConfig
(
'date'
,
array
(
'google_api_key'
=>
'your_google_api_key_here'
));
$telegram
->
setCommandConfig
(
'date'
,
array
(
'google_api_key'
=>
'your_google_api_key_here'
));
...
@@ -147,11 +143,9 @@ If you want insert in database messages/users for further usage in commands, cre
...
@@ -147,11 +143,9 @@ If you want insert in database messages/users for further usage in commands, cre
```
php
```
php
<?php
<?php
$credentials
=
array
(
'host'
=>
'localhost'
,
'user'
=>
'dbuser'
,
'password'
=>
'dbpass'
,
'database'
=>
'dbname'
);
$credentials
=
array
(
'host'
=>
'localhost'
,
'user'
=>
'dbuser'
,
'password'
=>
'dbpass'
,
'database'
=>
'dbname'
);
$telegram
->
enableMySQL
(
$credentials
);
$telegram
->
enableMySQL
(
$credentials
);
```
```
You can set a custom prefix to all the tables while you are enabling mysql:
You can set a custom prefix to all the tables while you are enabling mysql:
...
@@ -172,8 +166,8 @@ It can execute command triggering a chat event. Here's the list:
...
@@ -172,8 +166,8 @@ It can execute command triggering a chat event. Here's the list:
-
Left chat participant (
**LeftchatparticipantCommand.php**
)
-
Left chat participant (
**LeftchatparticipantCommand.php**
)
**GenericCommand.php**
let you handle commands that non exist or use commands as var:
**GenericCommand.php**
let you handle commands that non exist or use commands as var:
Favourite colour?
**/blac /red**
Favourite colour?
**/blac
k
/red**
Favourite number?
**/1 /134
**
Favourite number?
**/1 /134**
Maybe you would like to develop your own commands. A good practice is to store them outside vendor/. This can be done adding before the method:
Maybe you would like to develop your own commands. A good practice is to store them outside vendor/. This can be done adding before the method:
...
...
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