@@ -100,7 +100,6 @@ You must set [WebHook](https://core.telegram.org/bots/api#setwebhook)
100
100
Create set.php and put:
101
101
``` php
102
102
<?php
103
-
104
103
$loader = require __DIR__.'/vendor/autoload.php';
105
104
106
105
$API_KEY = 'your_bot_api_key';
@@ -109,7 +108,6 @@ $BOT_NAME = 'namebot';
109
108
try {
110
109
// create Telegram API object
111
110
$telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
112
-
113
111
// set webhook
114
112
echo $telegram->setWebHook('https://yourdomain/yourpath_to_hook.php');
115
113
} catch (Longman\TelegramBot\Exception\TelegramException $e) {
@@ -122,7 +120,6 @@ And open your set.php via browser
122
120
After create hook.php and put:
123
121
``` php
124
122
<?php
125
-
126
123
$loader = require __DIR__.'/vendor/autoload.php';
127
124
128
125
$API_KEY = 'your_bot_api_key';
@@ -131,7 +128,6 @@ $BOT_NAME = 'namebot';
131
128
try {
132
129
// create Telegram API object
133
130
$telegram = new Longman\TelegramBot\Telegram($API_KEY,$BOT_NAME);
134
-
135
131
// here you can set some command specified parameters, for example, google geocode/timezone api key for date command:
136
132
$telegram->setCommandConfig('date', array('google_api_key'=>'your_google_api_key_here'));
137
133
@@ -147,11 +143,9 @@ If you want insert in database messages/users for further usage in commands, cre
147
143
148
144
``` php
149
145
<?php
150
-
151
146
$credentials = array('host'=>'localhost', 'user'=>'dbuser', 'password'=>'dbpass', 'database'=>'dbname');
152
147
153
148
$telegram->enableMySQL($credentials);
154
-
155
149
```
156
150
You can set a custom prefix to all the tables while you are enabling mysql:
157
151
@@ -172,8 +166,8 @@ It can execute command triggering a chat event. Here's the list:
172
166
- Left chat participant (** LeftchatparticipantCommand.php** )
173
167
174
168
** GenericCommand.php** let you handle commands that non exist or use commands as var:
175
- Favourite colour? ** /blac /red**
176
- Favourite number? ** /1 /134 **
169
+ Favourite colour? ** /black /red**
170
+ Favourite number? ** /1 /134**
177
171
178
172
179
173
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:
0 commit comments